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
chenpangpang
ComfyUI
Commits
c02a554b
Commit
c02a554b
authored
May 15, 2023
by
comfyanonymous
Browse files
Make DiffusersLoader work with subfolders.
parent
ef815ba1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
nodes.py
nodes.py
+7
-4
No files found.
nodes.py
View file @
c02a554b
...
...
@@ -282,7 +282,10 @@ class DiffusersLoader:
paths
=
[]
for
search_path
in
folder_paths
.
get_folder_paths
(
"diffusers"
):
if
os
.
path
.
exists
(
search_path
):
paths
+=
next
(
os
.
walk
(
search_path
))[
1
]
for
root
,
subdir
,
files
in
os
.
walk
(
search_path
,
followlinks
=
True
):
if
"model_index.json"
in
files
:
paths
.
append
(
os
.
path
.
relpath
(
root
,
start
=
search_path
))
return
{
"required"
:
{
"model_path"
:
(
paths
,),
}}
RETURN_TYPES
=
(
"MODEL"
,
"CLIP"
,
"VAE"
)
FUNCTION
=
"load_checkpoint"
...
...
@@ -292,9 +295,9 @@ class DiffusersLoader:
def
load_checkpoint
(
self
,
model_path
,
output_vae
=
True
,
output_clip
=
True
):
for
search_path
in
folder_paths
.
get_folder_paths
(
"diffusers"
):
if
os
.
path
.
exists
(
search_path
):
path
s
=
next
(
os
.
walk
(
search_path
))[
1
]
if
model_path
in
path
s
:
model_path
=
os
.
path
.
join
(
search_path
,
model_path
)
path
=
os
.
path
.
join
(
search_path
,
model_path
)
if
os
.
path
.
exists
(
path
)
:
model_path
=
path
break
return
comfy
.
diffusers_convert
.
load_diffusers
(
model_path
,
fp16
=
comfy
.
model_management
.
should_use_fp16
(),
output_vae
=
output_vae
,
output_clip
=
output_clip
,
embedding_directory
=
folder_paths
.
get_folder_paths
(
"embeddings"
))
...
...
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