Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix loading safety checker in pipeline #986

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions optimum/intel/openvino/modeling_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,9 @@ def _from_pretrained(
"tokenizer_2": None,
"tokenizer_3": None,
"feature_extractor": None,
"image_encoder": None,
"safety_checker": None,
}

additional_submodels = ["image_encoder", "safety_checker"]
Copy link
Member

@IlyasMoutawwakil IlyasMoutawwakil Nov 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't solves the issue as it will just ignore and not load the safety_checker for example.
I provide a fix based on how diffusers handle the case of library_name being a module in their pipelines module #975 (comment)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pk, thanks, than I can close my pr?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, let's try merging the other PR today, it should accelerate per-commit openvino CI back to ~20mins

for name in submodels.keys():
if kwargs.get(name) is not None:
submodels[name] = kwargs.pop(name)
Expand All @@ -437,7 +437,12 @@ def _from_pretrained(
}

for config_key, value in config.items():
if config_key not in models and config_key not in kwargs and config_key not in submodels:
if (
config_key not in models
and config_key not in kwargs
and config_key not in submodels
and config_key not in additional_submodels
):
kwargs[config_key] = value

compile_only = kwargs.get("compile_only", False)
Expand Down
Loading