Skip to content

Commit

Permalink
Skip saving gen config if saving failed (#717)
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova authored May 17, 2024
1 parent c30d488 commit 715c054
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion optimum/exporters/openvino/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,12 @@ def export_from_model(
model.config.save_pretrained(output)
generation_config = getattr(model, "generation_config", None)
if generation_config is not None:
generation_config.save_pretrained(output)
try:
generation_config.save_pretrained(output)
except Exception as exception:
logger.warning(
f"The generation config will not be saved, saving failed with following error:\n{exception}"
)

model_name_or_path = model.config._name_or_path
maybe_save_preprocessors(model_name_or_path, output, trust_remote_code=trust_remote_code)
Expand Down

0 comments on commit 715c054

Please sign in to comment.