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
a37261bb
"...gpu/git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "026365a6514f51531d476c1af12ae914e4cd5bd4"
Commit
a37261bb
authored
Jan 22, 2023
by
comfyanonymous
Browse files
Try to execute the outputs that take the less steps first.
parent
9baa48cb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
main.py
main.py
+27
-0
No files found.
main.py
View file @
a37261bb
...
@@ -59,6 +59,23 @@ def recursive_execute(prompt, outputs, current_item, extra_data={}):
...
@@ -59,6 +59,23 @@ def recursive_execute(prompt, outputs, current_item, extra_data={}):
outputs
[
unique_id
]
=
getattr
(
obj
,
obj
.
FUNCTION
)(
**
input_data_all
)
outputs
[
unique_id
]
=
getattr
(
obj
,
obj
.
FUNCTION
)(
**
input_data_all
)
return
executed
+
[
unique_id
]
return
executed
+
[
unique_id
]
def
recursive_will_execute
(
prompt
,
outputs
,
current_item
):
unique_id
=
current_item
inputs
=
prompt
[
unique_id
][
'inputs'
]
will_execute
=
[]
if
unique_id
in
outputs
:
return
[]
for
x
in
inputs
:
input_data
=
inputs
[
x
]
if
isinstance
(
input_data
,
list
):
input_unique_id
=
input_data
[
0
]
output_index
=
input_data
[
1
]
if
input_unique_id
not
in
outputs
:
will_execute
+=
recursive_will_execute
(
prompt
,
outputs
,
input_unique_id
)
return
will_execute
+
[
unique_id
]
def
recursive_output_delete_if_changed
(
prompt
,
old_prompt
,
outputs
,
current_item
):
def
recursive_output_delete_if_changed
(
prompt
,
old_prompt
,
outputs
,
current_item
):
unique_id
=
current_item
unique_id
=
current_item
inputs
=
prompt
[
unique_id
][
'inputs'
]
inputs
=
prompt
[
unique_id
][
'inputs'
]
...
@@ -120,7 +137,16 @@ class PromptExecutor:
...
@@ -120,7 +137,16 @@ class PromptExecutor:
current_outputs
=
set
(
self
.
outputs
.
keys
())
current_outputs
=
set
(
self
.
outputs
.
keys
())
executed
=
[]
executed
=
[]
try
:
try
:
to_execute
=
[]
for
x
in
prompt
:
for
x
in
prompt
:
class_
=
nodes
.
NODE_CLASS_MAPPINGS
[
prompt
[
x
][
'class_type'
]]
if
hasattr
(
class_
,
'OUTPUT_NODE'
):
to_execute
+=
[(
0
,
x
)]
while
len
(
to_execute
)
>
0
:
to_execute
=
sorted
(
list
(
map
(
lambda
a
:
(
len
(
recursive_will_execute
(
prompt
,
self
.
outputs
,
a
[
-
1
])),
a
[
-
1
]),
to_execute
)))
x
=
to_execute
.
pop
(
0
)[
-
1
]
class_
=
nodes
.
NODE_CLASS_MAPPINGS
[
prompt
[
x
][
'class_type'
]]
class_
=
nodes
.
NODE_CLASS_MAPPINGS
[
prompt
[
x
][
'class_type'
]]
if
hasattr
(
class_
,
'OUTPUT_NODE'
):
if
hasattr
(
class_
,
'OUTPUT_NODE'
):
if
class_
.
OUTPUT_NODE
==
True
:
if
class_
.
OUTPUT_NODE
==
True
:
...
@@ -132,6 +158,7 @@ class PromptExecutor:
...
@@ -132,6 +158,7 @@ class PromptExecutor:
valid
=
False
valid
=
False
if
valid
:
if
valid
:
executed
+=
recursive_execute
(
prompt
,
self
.
outputs
,
x
,
extra_data
)
executed
+=
recursive_execute
(
prompt
,
self
.
outputs
,
x
,
extra_data
)
except
Exception
as
e
:
except
Exception
as
e
:
print
(
traceback
.
format_exc
())
print
(
traceback
.
format_exc
())
to_delete
=
[]
to_delete
=
[]
...
...
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