Update tuner.py

This commit is contained in:
hoshi-hiyouga 2024-01-21 12:39:38 +08:00 committed by GitHub
parent 9cdbd3bfc8
commit 662b9a9dcf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -59,8 +59,8 @@ def export_model(args: Optional[Dict[str, Any]] = None):
if hasattr(model.config, "torch_dtype"): if hasattr(model.config, "torch_dtype"):
model = model.to(getattr(model.config, "torch_dtype")).to("cpu") model = model.to(getattr(model.config, "torch_dtype")).to("cpu")
else: else:
model = model.to(torch.float32).to("cpu") model = model.to(torch.float16).to("cpu")
setattr(model.config, "torch_dtype", "float32") setattr(model.config, "torch_dtype", torch.float16)
model.save_pretrained( model.save_pretrained(
save_directory=model_args.export_dir, save_directory=model_args.export_dir,