Compare commits

...

1 Commits

Author SHA1 Message Date
Kent Keirsey
21a05f4287 fix controlnets for latest diffusers v 2025-09-17 13:03:11 -04:00

View File

@@ -5,7 +5,11 @@ import torch
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,
@@ -775,7 +779,15 @@ class ControlNetModel(ModelMixin, ConfigMixin, FromOriginalModelMixin):
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
# patch LoRACompatibleConv to use original Conv2D forward function