Unverified Commit c7e08958 authored by Anatoly Belikov's avatar Anatoly Belikov Committed by GitHub
Browse files

handle case when controlnet is list or tuple (#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: default avatarPatrick von Platen <patrick.v.platen@gmail.com>
parent dd5a3629
...@@ -2433,8 +2433,8 @@ class FromSingleFileMixin: ...@@ -2433,8 +2433,8 @@ class FromSingleFileMixin:
from .models.controlnet import ControlNetModel from .models.controlnet import ControlNetModel
from .pipelines.controlnet.multicontrolnet import MultiControlNetModel from .pipelines.controlnet.multicontrolnet import MultiControlNetModel
# Model type will be inferred from the checkpoint. # list/tuple or a single instance of ControlNetModel or MultiControlNetModel
if not isinstance(controlnet, (ControlNetModel, MultiControlNetModel)): if not (isinstance(controlnet, (ControlNetModel, MultiControlNetModel)) or isinstance(controlnet, (list, tuple)) and isinstance(controlnet[0], ControlNetModel)):
raise ValueError("ControlNet needs to be passed if loading from ControlNet pipeline.") raise ValueError("ControlNet needs to be passed if loading from ControlNet pipeline.")
elif "StableDiffusion" in pipeline_name: elif "StableDiffusion" in pipeline_name:
# Model type will be inferred from the checkpoint. # Model type will be inferred from the checkpoint.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment