Skip to content

Commit

Permalink
fix backward compatibility for case loading preconverted sd without s…
Browse files Browse the repository at this point in the history
…aved safety checker (#1004)
  • Loading branch information
eaidova authored Nov 20, 2024
1 parent e3031f0 commit f755590
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions optimum/intel/openvino/modeling_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,14 @@ def _from_pretrained(
# Check if the module is in a subdirectory
if (model_save_path / name).is_dir():
submodels[name] = load_method(model_save_path / name)
# For backward compatibility with models exported using previous optimum version, where safety_checker saving was disabled
elif name == "safety_checker":
logger.warning(
"Pipeline config contains `safety_checker` subcomponent, while `safety_checker` is not available in model directory. "
"`safety_checker` will be disabled. If you want to enable it please set it explicitly to `from_pretrained` method "
"or reexport model with new optimum-intel version"
)
submodels[name] = None
else:
submodels[name] = load_method(model_save_path)

Expand Down

0 comments on commit f755590

Please sign in to comment.