Should V3 fingerprint_inputs() include normal node inputs, or only external state? #15954
|
I'm migrating a custom node to the V3 API and I'm a little confused about Suppose my node has normal widget inputs like: inputs=[
io.String.Input("path"),
io.Float.Input("strength", default=1.0),
]Do I need to include For example: @classmethod
def fingerprint_inputs(cls, path, strength):
return (path, strength)Or does ComfyUI already include ordinary prompt/widget inputs in its cache key? If they're already tracked, is For example, if the workflow contains: but In other words, is the intended distinction roughly: I'm trying to understand whether including ordinary node inputs again in |
Replies: 1 comment
|
You generally do not need to include normal node inputs again in ComfyUI already includes ordinary non-linked inputs in the node's cache signature. It also tracks linked upstream nodes through their signatures. So if For example, this would usually be redundant: @classmethod
def fingerprint_inputs(cls, path, strength):
return (path, strength)The main purpose of A file is a good example. Suppose the node input is: If the workflow still contains exactly the same string, ComfyUI sees the normal input as unchanged. But the contents of In that case, you could fingerprint the file's modification time: @classmethod
def fingerprint_inputs(cls, path, **kwargs):
return os.path.getmtime(path)or, if you need stronger change detection, return a hash of the file contents. So the distinction is roughly: So for your example, I would not include If One practical tradeoff: using |
You generally do not need to include normal node inputs again in
fingerprint_inputs().ComfyUI already includes ordinary non-linked inputs in the node's cache signature. It also tracks linked upstream nodes through their signatures. So if
pathorstrengthchanges normally, that change is already enough to invalidate the cached result.For example, this would usually be redundant:
The main purpose of
fingerprint_inputs()is to account for state that can change without the workflow inputs themselves changing.A file is a good example.
Suppose the node input is:
If the workflow still cont…