Update tuner.py

This commit is contained in:
hoshi-hiyouga 2024-05-11 23:55:59 +08:00 committed by GitHub
parent 13851fb045
commit 5f72439a1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -65,7 +65,7 @@ def export_model(args: Optional[Dict[str, Any]] = None) -> None:
raise ValueError("The model is not a `PreTrainedModel`, export aborted.") raise ValueError("The model is not a `PreTrainedModel`, export aborted.")
if getattr(model, "quantization_method", None) is None: # cannot convert dtype of a quantized model if getattr(model, "quantization_method", None) is None: # cannot convert dtype of a quantized model
output_dtype = torch.float16 output_dtype = getattr(model.config, "torch_dtype", torch.float16)
setattr(model.config, "torch_dtype", output_dtype) setattr(model.config, "torch_dtype", output_dtype)
model = model.to(output_dtype) model = model.to(output_dtype)