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
74fc7b77
Commit
74fc7b77
authored
Apr 16, 2023
by
comfyanonymous
Browse files
custom_nodes paths can now be set in the extra_model_paths.yaml
parent
bc16b70b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
19 deletions
+24
-19
extra_model_paths.yaml.example
extra_model_paths.yaml.example
+1
-1
folder_paths.py
folder_paths.py
+5
-2
main.py
main.py
+8
-7
nodes.py
nodes.py
+10
-9
No files found.
extra_model_paths.yaml.example
View file @
74fc7b77
...
@@ -18,6 +18,6 @@ a111:
...
@@ -18,6 +18,6 @@ a111:
#other_ui:
#other_ui:
# base_path: path/to/ui
# base_path: path/to/ui
# checkpoints: models/checkpoints
# checkpoints: models/checkpoints
# custom_nodes: path/custom_nodes
folder_paths.py
View file @
74fc7b77
...
@@ -12,8 +12,8 @@ except:
...
@@ -12,8 +12,8 @@ except:
folder_names_and_paths
=
{}
folder_names_and_paths
=
{}
base_path
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
models_dir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
,
"models"
)
models_dir
=
os
.
path
.
join
(
base_path
,
"models"
)
folder_names_and_paths
[
"checkpoints"
]
=
([
os
.
path
.
join
(
models_dir
,
"checkpoints"
)],
supported_ckpt_extensions
)
folder_names_and_paths
[
"checkpoints"
]
=
([
os
.
path
.
join
(
models_dir
,
"checkpoints"
)],
supported_ckpt_extensions
)
folder_names_and_paths
[
"configs"
]
=
([
os
.
path
.
join
(
models_dir
,
"configs"
)],
[
".yaml"
])
folder_names_and_paths
[
"configs"
]
=
([
os
.
path
.
join
(
models_dir
,
"configs"
)],
[
".yaml"
])
...
@@ -28,6 +28,9 @@ folder_names_and_paths["diffusers"] = ([os.path.join(models_dir, "diffusers")],
...
@@ -28,6 +28,9 @@ folder_names_and_paths["diffusers"] = ([os.path.join(models_dir, "diffusers")],
folder_names_and_paths
[
"controlnet"
]
=
([
os
.
path
.
join
(
models_dir
,
"controlnet"
),
os
.
path
.
join
(
models_dir
,
"t2i_adapter"
)],
supported_pt_extensions
)
folder_names_and_paths
[
"controlnet"
]
=
([
os
.
path
.
join
(
models_dir
,
"controlnet"
),
os
.
path
.
join
(
models_dir
,
"t2i_adapter"
)],
supported_pt_extensions
)
folder_names_and_paths
[
"upscale_models"
]
=
([
os
.
path
.
join
(
models_dir
,
"upscale_models"
)],
supported_pt_extensions
)
folder_names_and_paths
[
"upscale_models"
]
=
([
os
.
path
.
join
(
models_dir
,
"upscale_models"
)],
supported_pt_extensions
)
folder_names_and_paths
[
"custom_nodes"
]
=
([
os
.
path
.
join
(
base_path
,
"custom_nodes"
)],
[])
output_directory
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"output"
)
output_directory
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"output"
)
temp_directory
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"temp"
)
temp_directory
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"temp"
)
input_directory
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"input"
)
input_directory
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"input"
)
...
...
main.py
View file @
74fc7b77
...
@@ -81,6 +81,14 @@ if __name__ == "__main__":
...
@@ -81,6 +81,14 @@ if __name__ == "__main__":
server
=
server
.
PromptServer
(
loop
)
server
=
server
.
PromptServer
(
loop
)
q
=
execution
.
PromptQueue
(
server
)
q
=
execution
.
PromptQueue
(
server
)
extra_model_paths_config_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"extra_model_paths.yaml"
)
if
os
.
path
.
isfile
(
extra_model_paths_config_path
):
load_extra_path_config
(
extra_model_paths_config_path
)
if
args
.
extra_model_paths_config
:
for
config_path
in
itertools
.
chain
(
*
args
.
extra_model_paths_config
):
load_extra_path_config
(
config_path
)
init_custom_nodes
()
init_custom_nodes
()
server
.
add_routes
()
server
.
add_routes
()
hijack_progress
(
server
)
hijack_progress
(
server
)
...
@@ -91,13 +99,6 @@ if __name__ == "__main__":
...
@@ -91,13 +99,6 @@ if __name__ == "__main__":
dont_print
=
args
.
dont_print_server
dont_print
=
args
.
dont_print_server
extra_model_paths_config_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"extra_model_paths.yaml"
)
if
os
.
path
.
isfile
(
extra_model_paths_config_path
):
load_extra_path_config
(
extra_model_paths_config_path
)
if
args
.
extra_model_paths_config
:
for
config_path
in
itertools
.
chain
(
*
args
.
extra_model_paths_config
):
load_extra_path_config
(
config_path
)
if
args
.
output_directory
:
if
args
.
output_directory
:
output_dir
=
os
.
path
.
abspath
(
args
.
output_directory
)
output_dir
=
os
.
path
.
abspath
(
args
.
output_directory
)
...
...
nodes.py
View file @
74fc7b77
...
@@ -1178,15 +1178,16 @@ def load_custom_node(module_path):
...
@@ -1178,15 +1178,16 @@ def load_custom_node(module_path):
print
(
f
"Cannot import
{
module_path
}
module for custom nodes:"
,
e
)
print
(
f
"Cannot import
{
module_path
}
module for custom nodes:"
,
e
)
def
load_custom_nodes
():
def
load_custom_nodes
():
CUSTOM_NODE_PATH
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"custom_nodes"
)
node_paths
=
folder_paths
.
get_folder_paths
(
"custom_nodes"
)
possible_modules
=
os
.
listdir
(
CUSTOM_NODE_PATH
)
for
custom_node_path
in
node_paths
:
if
"__pycache__"
in
possible_modules
:
possible_modules
=
os
.
listdir
(
custom_node_path
)
possible_modules
.
remove
(
"__pycache__"
)
if
"__pycache__"
in
possible_modules
:
possible_modules
.
remove
(
"__pycache__"
)
for
possible_module
in
possible_modules
:
module_path
=
os
.
path
.
join
(
CUSTOM_NODE_PATH
,
possible_module
)
for
possible_module
in
possible_modules
:
if
os
.
path
.
isfile
(
module_path
)
and
os
.
path
.
splitext
(
module_path
)[
1
]
!=
".py"
:
continue
module_path
=
os
.
path
.
join
(
custom_node_path
,
possible_module
)
load_custom_node
(
module_path
)
if
os
.
path
.
isfile
(
module_path
)
and
os
.
path
.
splitext
(
module_path
)[
1
]
!=
".py"
:
continue
load_custom_node
(
module_path
)
def
init_custom_nodes
():
def
init_custom_nodes
():
load_custom_nodes
()
load_custom_nodes
()
...
...
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