Return True if at least one module in the model is already a BitLinear.
(model: LlamaForCausalLM)
| 52 | |
| 53 | |
| 54 | def _model_has_bitlinear(model: LlamaForCausalLM) -> bool: |
| 55 | """Return True if at least one module in the model is already a BitLinear.""" |
| 56 | return any(isinstance(m, BitLinear) for m in model.modules()) |
| 57 | |
| 58 | |
| 59 | def load_model(model_path: str, device: torch.device) -> tuple[LlamaForCausalLM, AutoTokenizer]: |