From 8e09f1d5a0374e517cd3226d9e174c86ac0b3d0a Mon Sep 17 00:00:00 2001 From: Dhruv Nair Date: Tue, 13 Feb 2024 03:26:55 +0000 Subject: [PATCH 1/3] update --- src/diffusers/loaders/controlnet.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/diffusers/loaders/controlnet.py b/src/diffusers/loaders/controlnet.py index 647c65a4ec7a..4f164ac4b3ce 100644 --- a/src/diffusers/loaders/controlnet.py +++ b/src/diffusers/loaders/controlnet.py @@ -89,6 +89,7 @@ def from_single_file(cls, pretrained_model_link_or_path, **kwargs): ``` """ original_config_file = kwargs.pop("original_config_file", None) + config_file = kwargs.pop("config_file", None) resume_download = kwargs.pop("resume_download", False) force_download = kwargs.pop("force_download", False) proxies = kwargs.pop("proxies", None) @@ -100,6 +101,10 @@ def from_single_file(cls, pretrained_model_link_or_path, **kwargs): use_safetensors = kwargs.pop("use_safetensors", True) class_name = cls.__name__ + if (config_file is not None) and (original_config_file is not None): + raise ValueError("Cannot pass both `config_file` and `original_config_file` should be passed.") + + original_config_file = config_file or original_config_file original_config, checkpoint = fetch_ldm_config_and_checkpoint( pretrained_model_link_or_path=pretrained_model_link_or_path, class_name=class_name, From df8cc178e2e17a7be81fc381609976a362095930 Mon Sep 17 00:00:00 2001 From: Dhruv Nair Date: Tue, 13 Feb 2024 03:49:06 +0000 Subject: [PATCH 2/3] update --- src/diffusers/loaders/controlnet.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/diffusers/loaders/controlnet.py b/src/diffusers/loaders/controlnet.py index 4f164ac4b3ce..b0c798cba225 100644 --- a/src/diffusers/loaders/controlnet.py +++ b/src/diffusers/loaders/controlnet.py @@ -38,6 +38,9 @@ def from_single_file(cls, pretrained_model_link_or_path, **kwargs): - A link to the `.ckpt` file (for example `"https://huggingface.co//blob/main/.ckpt"`) on the Hub. - A path to a *file* containing all pipeline weights. + config_file (`str`, *optional*): + Filepath to the configuration YAML file associated with the model. If not provided it will default to: + https://raw.githubusercontent.com/lllyasviel/ControlNet/main/models/cldm_v15.yaml torch_dtype (`str` or `torch.dtype`, *optional*): Override the default `torch.dtype` and load the model with another dtype. If `"auto"` is passed, the dtype is automatically derived from the model's weights. From 630cbf025021bb22603dfffa841146e2c4865b92 Mon Sep 17 00:00:00 2001 From: Dhruv Nair Date: Tue, 13 Feb 2024 12:26:02 +0000 Subject: [PATCH 3/3] update --- src/diffusers/loaders/controlnet.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/diffusers/loaders/controlnet.py b/src/diffusers/loaders/controlnet.py index b0c798cba225..4999ab32694b 100644 --- a/src/diffusers/loaders/controlnet.py +++ b/src/diffusers/loaders/controlnet.py @@ -105,7 +105,9 @@ def from_single_file(cls, pretrained_model_link_or_path, **kwargs): class_name = cls.__name__ if (config_file is not None) and (original_config_file is not None): - raise ValueError("Cannot pass both `config_file` and `original_config_file` should be passed.") + raise ValueError( + "You cannot pass both `config_file` and `original_config_file` to `from_single_file`. Please use only one of these arguments." + ) original_config_file = config_file or original_config_file original_config, checkpoint = fetch_ldm_config_and_checkpoint(