Skip to content

Fix legacy StableDiffusionPipeline init crash (#6969)#1

Open
srlynch1 wants to merge 1 commit into
mainfrom
e2e/2026-06-21-r2-diffusers-6969
Open

Fix legacy StableDiffusionPipeline init crash (#6969)#1
srlynch1 wants to merge 1 commit into
mainfrom
e2e/2026-06-21-r2-diffusers-6969

Conversation

@srlynch1

Copy link
Copy Markdown
Owner

Eval r2 fix for huggingface#6969: scalar guard in register_modules, TypeError in _fetch_class_library_tuple, 4 fast tests green.

Made with Cursor

…rgs (huggingface#6969)

Skip library-tuple registration for scalar values in register_modules and
__setattr__, and guard _fetch_class_library_tuple with TypeError. Adds fast
regression tests for legacy positional super().__init__ signatures.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Scalar skips config key
    • Changed the scalar branch in register_modules to register (None, None) in config like the None path, so config keys stay aligned with the init signature and .components no longer raises ValueError.

Create PR

Or push these changes by commenting:

@cursor push 496169cb19
Preview (496169cb19)
diff --git a/src/diffusers/pipelines/pipeline_utils.py b/src/diffusers/pipelines/pipeline_utils.py
--- a/src/diffusers/pipelines/pipeline_utils.py
+++ b/src/diffusers/pipelines/pipeline_utils.py
@@ -215,7 +215,7 @@
             elif isinstance(module, (bool, int, float, str)):
                 # Scalar values (e.g. bool mis-passed as image_encoder from legacy super().__init__) are not
                 # model components — skip library tuple registration. See https://github.com/huggingface/diffusers/issues/6969
-                register_dict = {}
+                register_dict = {name: (None, None)}
             else:
                 library, class_name = _fetch_class_library_tuple(module)
                 register_dict = {name: (library, class_name)}

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit 69ee02e. Configure here.

# save model index config
self.register_to_config(**register_dict)
if register_dict:
self.register_to_config(**register_dict)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Scalar skips config key

Medium Severity

When register_modules receives a scalar component (e.g. a bool mis-bound to image_encoder), it sets an empty register_dict and skips register_to_config, unlike None which records (None, None). The attribute is still set, but the config omits that module name. components builds keys from config and then requires they match the init signature, so legacy-init pipelines can raise ValueError after init succeeds.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 69ee02e. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant