Skip to content
Open
Show file tree
Hide file tree
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: 11 additions & 0 deletions b/src/diffusers/pipelines/pipeline_loading_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@


def _fetch_class_library_tuple(module):
# Guard against non-module values (bool, int, str, etc.) that can be passed
# when a positional argument shift occurs in subclasses (e.g. issue #6969).
if not isinstance(module, (torch.nn.Module, type)):
return (None, None)

# import it here to avoid circular import
diffusers_module = importlib.import_module(__name__.split(".")[0])
pipelines = getattr(diffusers_module, "pipelines")
5 changes: 5 additions & 0 deletions src/diffusers/pipelines/pipeline_loading_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,11 @@ def _get_load_method(class_obj: object, load_method_name: str, is_dduf: bool) ->


def _fetch_class_library_tuple(module):
# Guard against non-module values (bool, int, str, etc.) that can be passed
# when a positional argument shift occurs in subclasses (e.g. issue #6969).
if not isinstance(module, (torch.nn.Module, type)):
return (None, None)

# import it here to avoid circular import
diffusers_module = importlib.import_module(__name__.split(".")[0])
pipelines = getattr(diffusers_module, "pipelines")
Expand Down
Loading