Skip to content
Open
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
16 changes: 14 additions & 2 deletions invokeai/backend/util/hotfixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
from diffusers.configuration_utils import ConfigMixin, register_to_config
from diffusers.loaders.single_file_model import FromOriginalModelMixin
from diffusers.models.attention_processor import AttentionProcessor, AttnProcessor
from diffusers.models.controlnet import ControlNetConditioningEmbedding, ControlNetOutput, zero_module
from diffusers.models.controlnets.controlnet import (
ControlNetConditioningEmbedding,
ControlNetOutput,
zero_module,
)
from diffusers.models.embeddings import (
TextImageProjection,
TextImageTimeEmbedding,
Expand Down Expand Up @@ -775,7 +779,15 @@ def forward(


diffusers.ControlNetModel = ControlNetModel
diffusers.models.controlnet.ControlNetModel = ControlNetModel
# Patch both the new and legacy module paths for compatibility
try:
diffusers.models.controlnets.controlnet.ControlNetModel = ControlNetModel
except Exception:
# Fallback for environments still exposing the legacy path
try:
diffusers.models.controlnet.ControlNetModel = ControlNetModel
except Exception:
pass
Copy link

Choose a reason for hiding this comment

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

Bug: Incompatible Import Path Breaks Module Compatibility

The module's import statement unconditionally uses the new diffusers.models.controlnets.controlnet path. This causes an ImportError on older diffusers versions, preventing the module from loading and making the patching logic's compatibility fallback unreachable.

Fix in Cursor Fix in Web



# patch LoRACompatibleConv to use original Conv2D forward function
Expand Down