MCPcopy Create free account
hub / github.com/InternLM/InternBootcamp / infer_batch

Method infer_batch

verl/verl/workers/engine/base.py:133–148  ·  view source on GitHub ↗

Perform inference on a batch of data. Args: data: The input data for inference, typically containing tensors and metadata. Returns: Any: The output of the inference, which can be used for predictions or other purposes.

(self, data: TensorDict, loss_function: Optional[Callable] = None)

Source from the content-addressed store, hash-verified

131 return outputs
132
133 def infer_batch(self, data: TensorDict, loss_function: Optional[Callable] = None) -> Any:
134 """
135 Perform inference on a batch of data.
136
137 Args:
138 data: The input data for inference, typically containing tensors and metadata.
139
140 Returns:
141 Any: The output of the inference, which can be used for predictions or other purposes.
142 """
143 # see comments from train_batch
144 maybe_fix_3d_position_ids(data)
145
146 with torch.no_grad():
147 outputs = self.forward_backward_batch(data, loss_function, forward_only=True)
148 return outputs
149
150 def get_per_tensor_param(self) -> tuple[Generator[tuple[str, torch.Tensor], None, None], Optional[dict]]:
151 """

Callers 5

test_actor_engineFunction · 0.45
test_critic_engineFunction · 0.45
fitMethod · 0.45
fitMethod · 0.45
_compute_valuesMethod · 0.45

Calls 2

Tested by 2

test_actor_engineFunction · 0.36
test_critic_engineFunction · 0.36