MCPcopy
hub / github.com/InternLM/InternLM / execute_schedule

Method execute_schedule

internlm/core/trainer.py:156–168  ·  view source on GitHub ↗

Runs the forward, loss computation, and backward for the model. Returns a tuple of (output, label, loss). Args: data_iter (Iterable): The data iterator. **kwargs: Additional keyword arguments. Returns: Tuple[:class:`torch.Tensor`]: A tupl

(self, data_iter: Iterable, **kwargs)

Source from the content-addressed store, hash-verified

154 return self._engine.step()
155
156 def execute_schedule(self, data_iter: Iterable, **kwargs):
157 """Runs the forward, loss computation, and backward for the model.
158 Returns a tuple of (output, label, loss).
159
160 Args:
161 data_iter (Iterable): The data iterator.
162 **kwargs: Additional keyword arguments.
163
164 Returns:
165 Tuple[:class:`torch.Tensor`]: A tuple of (output, label, loss).
166 """
167 output, label, loss = self._schedule.forward_backward_step(self._engine, data_iter, **kwargs)
168 return output, label, loss

Callers 2

mainFunction · 0.80
evaluate_on_val_dlsFunction · 0.80

Calls 1

forward_backward_stepMethod · 0.45

Tested by

no test coverage detected