From 235770dd841080d60f734db09459d0f855ccda46 Mon Sep 17 00:00:00 2001 From: Pedro Cuenca Date: Tue, 27 Sep 2022 20:19:04 +0200 Subject: [PATCH] Fix `main`: stable diffusion pipelines cannot be loaded (#655) * 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 ``. * Revert "Replace deprecation warning f-string with class name." This reverts commit 1c4eb8cb104374bd84e43865fc3865862473799c. * 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. --- src/diffusers/configuration_utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/diffusers/configuration_utils.py b/src/diffusers/configuration_utils.py index 19f58fd816..59c9315789 100644 --- a/src/diffusers/configuration_utils.py +++ b/src/diffusers/configuration_utils.py @@ -58,6 +58,10 @@ class ConfigMixin: 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)