()
| 526 | |
| 527 | # bf16 > fp16 > fp32 |
| 528 | def preferred_dtype(): |
| 529 | if get_accelerator().is_bf16_supported(): |
| 530 | return torch.bfloat16 |
| 531 | elif get_accelerator().is_fp16_supported(): |
| 532 | return torch.float16 |
| 533 | else: |
| 534 | return torch.float32 |
| 535 | |
| 536 | |
| 537 | class EnableDeterminism: |