()
| 513 | |
| 514 | # bf16 > fp16 > fp32 |
| 515 | def preferred_dtype(): |
| 516 | if get_accelerator().is_bf16_supported(): |
| 517 | return torch.bfloat16 |
| 518 | elif get_accelerator().is_fp16_supported(): |
| 519 | return torch.float16 |
| 520 | else: |
| 521 | return torch.float32 |
| 522 | |
| 523 | |
| 524 | class EnableDeterminism: |