-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce repeated calls of get_immediate_node_signature in cache #4871
Merged
comfyanonymous
merged 1 commit into
comfyanonymous:master
from
JettHu:feature/improve_immediate_node_signature
Sep 13, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't persist the signatures in the cache keyed by ID. The whole point of the cache is that it persists between executions and there's no guarantee that node signatures will be the same from one execution to the next.
Long term, I think the right solution is to cache entire node definitions somewhere. I have that change locally, but it's grouped with a bunch of others and I won't be able to split it out until this weekend.
Shorter term, if you just reset the
.immediate_node_signature
at the beginning of each execution, that should work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My current hot fix right now is caching I/O calls within
folder_paths.py
(i.eos.path.*
), which the I/O cache can reset wheneverobject_info
api are called and it seems to work so far.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently,
cache.set_prompt
will reinitialize acache_key_set
each time see.That is, the
cache_key_set
between each execution is two independent objects. So from the current implementation,.immediate_node_signature
is indeed reset for each execution, because thecache_key_set
is different.This variable is added only to avoid repeated
get_immediate_node_signature
inget_node_signature
of one workflow execution, and has nothing to do with other executions.Of course, it would be better if this call could be further reduced, because the current implementation can only reduce one
cache
to be executed at a time, and there are also repeatedget_immediate_node_signature
betweencaches.outputs
andcaches.ui
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also a good approach. This PR takes into account more time-consuming
INPUT_TYPES
issues. I think I/O calls withinfolder_paths.py
is just one of the exposed.