Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
renzhc
diffusers_dcu
Commits
3cf4f9c7
Unverified
Commit
3cf4f9c7
authored
Feb 13, 2024
by
Dhruv Nair
Committed by
GitHub
Feb 13, 2024
Browse files
Allow passing `config_file` argument to ControlNetModel when using `from_single_file` (#6959)
* update * update * update
parent
40dd9cb2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
src/diffusers/loaders/controlnet.py
src/diffusers/loaders/controlnet.py
+10
-0
No files found.
src/diffusers/loaders/controlnet.py
View file @
3cf4f9c7
...
...
@@ -38,6 +38,9 @@ class FromOriginalControlNetMixin:
- A link to the `.ckpt` file (for example
`"https://huggingface.co/<repo_id>/blob/main/<path_to_file>.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.
...
...
@@ -89,6 +92,7 @@ class FromOriginalControlNetMixin:
```
"""
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 +104,12 @@ class FromOriginalControlNetMixin:
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
(
"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
(
pretrained_model_link_or_path
=
pretrained_model_link_or_path
,
class_name
=
class_name
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment