MCPcopy Create free account
hub / github.com/Pints-AI/1.5-Pints / parse_devices

Function parse_devices

lit_gpt/utils.py:497–502  ·  view source on GitHub ↗
(devices: Union[str, int])

Source from the content-addressed store, hash-verified

495
496
497def parse_devices(devices: Union[str, int]) -> int:
498 if devices in (-1, 'auto'):
499 return torch.cuda.device_count() or 1
500 if isinstance(devices, int) and devices > 0:
501 return devices
502 raise ValueError(f"Devices must be 'auto' or a positive integer, got: {devices!r}")
503
504
505def choose_logger(

Callers 1

setupFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected