MCPcopy
hub / github.com/Tele-AI/Telechat / to_device

Function to_device

deepspeed-telechat/utils/utils.py:19–26  ·  view source on GitHub ↗
(batch, device)

Source from the content-addressed store, hash-verified

17
18
19def to_device(batch, device):
20 output = {}
21 for k, v in batch.items():
22 try:
23 output[k] = v.to(device)
24 except:
25 output[k] = v
26 return output
27
28def get_dtype_size(dtype):
29 if dtype == torch.bool:

Callers 1

mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected