@@ -38,6 +38,9 @@ def from_single_file(cls, pretrained_model_link_or_path, **kwargs):
38
38
- A link to the `.ckpt` file (for example
39
39
`"https://huggingface.co/<repo_id>/blob/main/<path_to_file>.ckpt"`) on the Hub.
40
40
- A path to a *file* containing all pipeline weights.
41
+ config_file (`str`, *optional*):
42
+ Filepath to the configuration YAML file associated with the model. If not provided it will default to:
43
+ https://raw.githubusercontent.com/lllyasviel/ControlNet/main/models/cldm_v15.yaml
41
44
torch_dtype (`str` or `torch.dtype`, *optional*):
42
45
Override the default `torch.dtype` and load the model with another dtype. If `"auto"` is passed, the
43
46
dtype is automatically derived from the model's weights.
@@ -89,6 +92,7 @@ def from_single_file(cls, pretrained_model_link_or_path, **kwargs):
89
92
```
90
93
"""
91
94
original_config_file = kwargs .pop ("original_config_file" , None )
95
+ config_file = kwargs .pop ("config_file" , None )
92
96
resume_download = kwargs .pop ("resume_download" , False )
93
97
force_download = kwargs .pop ("force_download" , False )
94
98
proxies = kwargs .pop ("proxies" , None )
@@ -100,6 +104,12 @@ def from_single_file(cls, pretrained_model_link_or_path, **kwargs):
100
104
use_safetensors = kwargs .pop ("use_safetensors" , True )
101
105
102
106
class_name = cls .__name__
107
+ if (config_file is not None ) and (original_config_file is not None ):
108
+ raise ValueError (
109
+ "You cannot pass both `config_file` and `original_config_file` to `from_single_file`. Please use only one of these arguments."
110
+ )
111
+
112
+ original_config_file = config_file or original_config_file
103
113
original_config , checkpoint = fetch_ldm_config_and_checkpoint (
104
114
pretrained_model_link_or_path = pretrained_model_link_or_path ,
105
115
class_name = class_name ,
0 commit comments