Skip to content

Commit c7e0895

Browse files
handle case when controlnet is list or tuple (huggingface#5179)
* handle case when controlnet is list * Update src/diffusers/loaders.py * Apply suggestions from code review * Update src/diffusers/loaders.py * typecheck comment --------- Co-authored-by: Patrick von Platen <[email protected]>
1 parent dd5a362 commit c7e0895

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/diffusers/loaders.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2433,8 +2433,8 @@ def from_single_file(cls, pretrained_model_link_or_path, **kwargs):
24332433
from .models.controlnet import ControlNetModel
24342434
from .pipelines.controlnet.multicontrolnet import MultiControlNetModel
24352435

2436-
# Model type will be inferred from the checkpoint.
2437-
if not isinstance(controlnet, (ControlNetModel, MultiControlNetModel)):
2436+
# list/tuple or a single instance of ControlNetModel or MultiControlNetModel
2437+
if not (isinstance(controlnet, (ControlNetModel, MultiControlNetModel)) or isinstance(controlnet, (list, tuple)) and isinstance(controlnet[0], ControlNetModel)):
24382438
raise ValueError("ControlNet needs to be passed if loading from ControlNet pipeline.")
24392439
elif "StableDiffusion" in pipeline_name:
24402440
# Model type will be inferred from the checkpoint.

0 commit comments

Comments
 (0)