mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-10-15 08:08:09 +08:00
fix torch_dtype check of export_model
Former-commit-id: 8813181b6bffa76e5c7cb1f4caceada611c54b9d
This commit is contained in:
parent
ab67528e89
commit
d19cb77d74
@ -57,7 +57,7 @@ def export_model(args: Optional[Dict[str, Any]] = None):
|
||||
raise ValueError("The model is not a `PreTrainedModel`, export aborted.")
|
||||
|
||||
setattr(model.config, "use_cache", True)
|
||||
if getattr(model.config, "torch_dtype", None) == "bfloat16":
|
||||
if getattr(model.config, "torch_dtype", None) == torch.bfloat16:
|
||||
model = model.to(torch.bfloat16).to("cpu")
|
||||
else:
|
||||
model = model.to(torch.float16).to("cpu")
|
||||
|
Loading…
x
Reference in New Issue
Block a user