fix export
This commit is contained in:
1 parent
6ebde4f23e
commit
6bc2c23b6d
1 file changed
+2
-1
@@ -60,8 +60,9 @@ def export_model(args: Optional[Dict[str, Any]] = None):
|
|||||||
|
|
||||||
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 = getattr(model.config, "torch_dtype", torch.float16)
|
output_dtype = getattr(model.config, "torch_dtype", torch.float16)
|
||||||
model = model.to(output_dtype)
|
|
||||||
setattr(model.config, "torch_dtype", output_dtype)
|
setattr(model.config, "torch_dtype", output_dtype)
|
||||||
|
for param in model.parameters():
|
||||||
|
param.data = param.data.to(output_dtype)
|
||||||
|
|
||||||
model.save_pretrained(
|
model.save_pretrained(
|
||||||
save_directory=model_args.export_dir,
|
save_directory=model_args.export_dir,
|
||||||
|
|||||||
Reference in new issue
Block a user