()
| 44 | # ────────────────────────────────────────────────────────────────────────────── |
| 45 | |
| 46 | def get_device() -> torch.device: |
| 47 | if torch.cuda.is_available(): |
| 48 | return torch.device("cuda") |
| 49 | if torch.backends.mps.is_available(): |
| 50 | return torch.device("mps") |
| 51 | return torch.device("cpu") |
| 52 | |
| 53 | |
| 54 | def _model_has_bitlinear(model: LlamaForCausalLM) -> bool: |