Skip to content

Commit 792e2d5

Browse files
committed
skip saving gen config if saving failed
1 parent c30d488 commit 792e2d5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

optimum/exporters/openvino/convert.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,10 @@ def export_from_model(
614614
model.config.save_pretrained(output)
615615
generation_config = getattr(model, "generation_config", None)
616616
if generation_config is not None:
617-
generation_config.save_pretrained(output)
617+
try:
618+
generation_config.save_pretrained(output)
619+
except Exception as exception:
620+
logger.warning(f"The generation config will not be saved, saving failed with following error:\n{exception}")
618621

619622
model_name_or_path = model.config._name_or_path
620623
maybe_save_preprocessors(model_name_or_path, output, trust_remote_code=trust_remote_code)

0 commit comments

Comments
 (0)