Skip to content

Commit

Permalink
Fix main: stable diffusion pipelines cannot be loaded (#655)
Browse files Browse the repository at this point in the history
* Replace deprecation warning f-string with class name.

When `__repr__` is invoked in the instance serialization of
`config_dict` fails, because it contains `kwargs` of type `<class
inspect._empty>`.

* Revert "Replace deprecation warning f-string with class name."

This reverts commit 1c4eb8c.

* Do not attempt to register `"kwargs"` as an attribute.

Otherwise serialization could fail.
This may happen for other attributes, so we should create a better
solution.
  • Loading branch information
pcuenca authored Sep 27, 2022
1 parent d8572f2 commit 235770d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/diffusers/configuration_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ def register_to_config(self, **kwargs):
kwargs["_class_name"] = self.__class__.__name__
kwargs["_diffusers_version"] = __version__

# Special case for `kwargs` used in deprecation warning added to schedulers
# TODO: remove this when we remove the deprecation warning, and the `kwargs` argument,
# or solve in a more general way.
kwargs.pop("kwargs", None)
for key, value in kwargs.items():
try:
setattr(self, key, value)
Expand Down

0 comments on commit 235770d

Please sign in to comment.