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

Function get_default_supported_precision

lit_gpt/utils.py:342–357  ·  view source on GitHub ↗

Return default precision that is supported by the hardware: either `bf16` or `16`. Args: training: `-mixed` or `-true` version of the precision to use Returns: default precision that is suitable for the task and is supported by the hardware

(training: bool)

Source from the content-addressed store, hash-verified

340
341
342def get_default_supported_precision(training: bool) -> str:
343 """Return default precision that is supported by the hardware: either `bf16` or `16`.
344
345 Args:
346 training: `-mixed` or `-true` version of the precision to use
347
348 Returns:
349 default precision that is suitable for the task and is supported by the hardware
350 """
351 from lightning.fabric.accelerators import MPSAccelerator
352
353 if MPSAccelerator.is_available() or (
354 torch.cuda.is_available() and not torch.cuda.is_bf16_supported()
355 ):
356 return '16-mixed' if training else '16-true'
357 return 'bf16-mixed' if training else 'bf16-true'
358
359
360def load_checkpoint(

Callers 1

setupFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected