MCPcopy Create free account
hub / github.com/AIS-SNU/Smart-Infinity / process_batch

Function process_batch

DeepSpeedExample/tasks/finetune_utils.py:34–45  ·  view source on GitHub ↗

Process batch and produce inputs for the model.

(batch)

Source from the content-addressed store, hash-verified

32
33
34def process_batch(batch):
35 """Process batch and produce inputs for the model."""
36 args = get_args()
37
38 tokens = batch['text'].long().cuda().contiguous()
39 types = batch['types'].long().cuda().contiguous()
40 labels = batch['label'].long().cuda().contiguous()
41 attention_mask = batch['padding_mask'].float().cuda().contiguous()
42 if args.fp16:
43 attention_mask = attention_mask.half()
44
45 return tokens, types, labels, attention_mask
46
47
48def _cross_entropy_forward_step(batch, model):

Callers 2

Calls 1

get_argsFunction · 0.90

Tested by

no test coverage detected