You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One feature that comfy is lacking is function calling.
A few years ago I was writing a node-based program for procedural generation of animations and found the following convention works really well:
have node type that operates like a re-route node called "input"
this node should have 1 input, 1 output and a field called "name"
have a node type that operates like a re-route node called "output"
this node should have 1 input, 1 output and a field called "name"
Save a workflow with these nodes
Have a node type called "function" that allows you to select the saved workflow
The function node now has the the inputs and outputs of the saved workflow.
For example, this workflow
would produce a function node with 1 input of type text
and one output of type image.
The "function" node would operate exactly as though you had the entire workflow in the middle.
If some of the inputs were not connected, the input would be the input from the original workflow,
but if they are connected, the input would be from the input connected to the function block.
This makes it much easier to reuse blocks of nodes, and it is also to make workflows look dramatically less like a tangle of spaghetti.
A few things that are tricky:
if the workflow inside your function has a seed node with "randomize on every generation", it needs to be randomized every time the function is called.
if a function call uses one of its outputs as its own inputs you can potentially get infinite loops. This can be solved either with a big "don't do this" sign, or by trying to be clever about determining whether a loop is infinite or not.
if you load a different workflow into the function node, the inputs/outputs will change. You can either try to match up the old inputs, or just disconnect everything.
Need a standard place to save workflows that are used as function calls (and to share workflows that depend on other workflows as functions). Easiest convention is either comfy/workflows or the function workflows must be in same directory as the parent workflow. Alternative is to save the parent/function workflows in the same file somehow.
once you have functions, there is going to be the temptation to implement other programming primitives: loops and composite types. These are both possible, but require more careful thought.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
One feature that comfy is lacking is function calling.
A few years ago I was writing a node-based program for procedural generation of animations and found the following convention works really well:
this node should have 1 input, 1 output and a field called "name"
this node should have 1 input, 1 output and a field called "name"
The function node now has the the inputs and outputs of the saved workflow.
For example, this workflow
would produce a function node with 1 input of type text
and one output of type image.
The "function" node would operate exactly as though you had the entire workflow in the middle.
If some of the inputs were not connected, the input would be the input from the original workflow,
but if they are connected, the input would be from the input connected to the function block.
This makes it much easier to reuse blocks of nodes, and it is also to make workflows look dramatically less like a tangle of spaghetti.
A few things that are tricky:
Beta Was this translation helpful? Give feedback.
All reactions