MCPcopy Create free account
hub / github.com/zai-org/CodeGeeX / forward_step

Function forward_step

codegeex/megatron/tools/finetune_codegeex.py:200–212  ·  view source on GitHub ↗

Forward step.

(data_iterator, model)

Source from the content-addressed store, hash-verified

198
199
200def forward_step(data_iterator, model):
201 """Forward step."""
202 args = get_args()
203 timers = get_timers()
204
205 # Get the batch.
206 timers("batch-generator").start()
207 tokens, labels, loss_mask, attention_mask, position_ids = get_batch(data_iterator)
208 timers("batch-generator").stop()
209
210 output_tensor = model(tokens, position_ids, attention_mask, labels=labels)
211
212 return output_tensor, partial(loss_func, loss_mask)
213
214
215def valid_forward_step(data_iterator, model):

Callers

nothing calls this directly

Calls 5

get_argsFunction · 0.90
get_timersFunction · 0.90
startMethod · 0.80
stopMethod · 0.80
get_batchFunction · 0.70

Tested by

no test coverage detected