This commit is contained in:
hiyouga 2024-05-12 00:03:59 +08:00
parent b033232aea
commit 56857770f8
1 changed files with 2 additions and 0 deletions

View File

@ -68,6 +68,8 @@ def export_model(args: Optional[Dict[str, Any]] = None) -> None:
output_dtype = getattr(model.config, "torch_dtype", torch.float16)
setattr(model.config, "torch_dtype", output_dtype)
model = model.to(output_dtype)
else:
setattr(model.config, "torch_dtype", torch.float16)
model.save_pretrained(
save_directory=model_args.export_dir,