Skip to content
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

[WORKFLOW] XY Grid Example #15

Open
bananasss00 opened this issue Dec 24, 2023 · 21 comments
Open

[WORKFLOW] XY Grid Example #15

bananasss00 opened this issue Dec 24, 2023 · 21 comments

Comments

@bananasss00
Copy link

xy_grid
xy_grid.json

With your nodes you can make grids of any complexity, though not as convenient. But thanks anyway :)

@Trung0246
Copy link
Owner

Trung0246 commented Dec 24, 2023

Actually with the recent Script node you can create multiple batches then execute using cycle mode from the ScriptPlan which will iterate through every possible permutation ;)

Even better Hub node can directly create batch without going through JunctionBatch.

@bananasss00
Copy link
Author

I haven't quite figured out these nodes yet, I'll be experimenting with them. There is not much information on how they work yet

@Trung0246
Copy link
Owner

Trung0246 commented Dec 24, 2023

workflow_grid

I also patched the code the bit, so make sure to update, otherwise the general workflow should works.

Currently Hub only support batch primitive data, not COMBO. I may plan to add BATCH support for COMBO probably.

Forgot to mentions the workflow is in the png.

@Trung0246
Copy link
Owner

Just pushed another update to support COMBO. I guess I should stop "small fixes" for now.

@JorgeR81
Copy link

@Trung0246 can you update your workflow here ?

When in run the queue, I've got this error:

Error occurred when executing 0246.Script:

list index out of range

File "C:\Cui\cu_121_2\ComfyUI_windows_portable\ComfyUI\execution.py", line 141, in recursive_execute
input_data_all = get_input_data(inputs, class_def, unique_id, outputs, prompt, extra_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Cui\cu_121_2\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-0246\utils.py", line 381, in new_func
res_value = old_func(*final_args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Cui\cu_121_2\ComfyUI_windows_portable\ComfyUI\execution.py", line 26, in get_input_data
obj = outputs[input_unique_id][output_index]
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^

@Trung0246
Copy link
Owner

Hm that looks weird. Maybe I could a look when I have time.

@DrJKL
Copy link

DrJKL commented Apr 7, 2024

image

I think these are the new connections.

@Trung0246
Copy link
Owner

Trung0246 commented Apr 7, 2024

Oh I thought that we are talking about the first one. Maybe Jorge can try again. Yeah the one JLK mentions is the correct connection.

@JorgeR81
Copy link

JorgeR81 commented Apr 7, 2024

Yes, it's working !

Just noticed, in the workflow image, that the [ script_excet_data ] output used to be in another node ...

old_wf

@JorgeR81
Copy link

JorgeR81 commented Apr 7, 2024

I've made a [ sampler x scheduler ] version of this workflow, with different hubs.

But when I load the workflow, the 2 hubs that use __BATCH_COMBO__ are allways disconnected.

Is this a bug, or am I doing something wrong ?

sampler_scheduler

@DrJKL
Copy link

DrJKL commented Apr 8, 2024

I can replicate the noodles being detached on load.
Same from

  • The PNG you posted
  • A PNG workflow I exported after connecting
  • The metadata saved in the PNG output of an image generated
  • The workflow.json save

@Trung0246
Copy link
Owner

Trung0246 commented Apr 8, 2024

Oh it just a minor bug as it's related to how I implemented input/output expand stuff. It kinda annoying but hopefully easy to fix when I have time.

@JorgeR81
Copy link

JorgeR81 commented Apr 9, 2024

I was trying to make a version of the first workflow, with the Junction Batch nodes.

But I can't make new connections.

And if I unplug the old ones, they stop working !

For example, if I unplug this Junction Bach node from the Merge node, when I plug it again, the "COMBO" designation is gone, from the output and input connections.
There is only an [ * ] and the workflow is broken.

But if I connect from the Junction Bach node above, which still has the "COMBO" designation in the output, the connection is successful ( see bottom image ).

Is this a bug, or is there another way to make new connections ?

test

test2

@JorgeR81
Copy link

JorgeR81 commented Apr 9, 2024

Using the CastReroute node, I'm able to create new output connections for "FLOAT" and "INT", in the Junction Bach node

Once I have the correct designation on the Junction Bach output, I can delete the CastReroute node.

But there is no option for "COMBO" in the CastReroute node ...

test3

@Trung0246
Copy link
Owner

Trung0246 commented Apr 10, 2024

The problem is COMBO did not actually exist internally but instead it is an array of string which decay to just a single STRING when processed. So that a weird quirk I'm unsure about when I implementing CastReroute and Hub, therefore I decided to leave it as it is. The problem is we wants to retain COMBO type (which is the case for Hub) to make it possible to connect to nodes that are actually expecting that type. Your best bet is convert COMBO to STRING before actually connecting to JunctionBatch then recast to * when connect to node that expecting COMBO.

All of this are why CastReroute exist in the first place, which is a tradeoff for being absurdly flexible.

@JorgeR81
Copy link

I'm able to change the output to STRING in the Junction Batch nodes.
But it does not work with STRING or [ * ].
It only works with COMBO.

I'm only able to use the 8 nodes that @bananasss00 connected in his workflow, which already have the output connections as COMBO.
If I copy and paste these nodes or if I save them as a template, the connections are changed back to [ * ].

If there was a special trick to make this connection, he would probably have explained how to do this, when he shared his workflow, in the first post.

Perhaps there is not a trick, and this was working correctly when he made the workflow.
I noticed that in his workflow image, the Merge nodes had an option called "same".
This option does not exist anymore.
Maybe this was broken when this option was changed ?

ban

@Trung0246
Copy link
Owner

Trung0246 commented Apr 10, 2024

I guess at one time I added COMBO to CastReroute but later deleted it since it's pointless. Probably have to take a look on how to handle this. Also weird I remembered wildcard * works for anything including COMBO.

Also copy-paste is also iffy so that another bug to the list but honestly I think reverting to * is expected behavior since the type resolving mechanism doesn't have a concrete input/output type to rely on.

Yeah same no longer exist. It is now flat probably. This is irrelevant btw.

@JorgeR81
Copy link

JorgeR81 commented Apr 10, 2024

I did find a trick to do this !

We can use other nodes with COMBO inputs instead of CastReroute.
When a Primitive it's connected to them, the connection output is turned in to COMBO.
And the same happens if we connect the JunctionBatch node, instead.

cp

You could try to add COMBO to CastReroute again, because it's a more elegant solution.
There is a single unconnected CastReroute node ( set to INT ), the worflow from @bananasss00, but I guess he used this for all the connections types.

But, if you can make the [ * ] connections work correctly, it would be even better, because then we could copy / paste your nodes, and use them as templates.

Now, if the connection is [ * ], it gives this error:

Error occurred when executing 0246.JunctionBatch:

Type "*" of output "*:0" does not available in junction.

File "C:\Cui\cu_121_2\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Cui\cu_121_2\ComfyUI_windows_portable\ComfyUI\execution.py", line 81, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Cui\cu_121_2\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-0246\utils.py", line 381, in new_func
res_value = old_func(*final_args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Cui\cu_121_2\ComfyUI_windows_portable\ComfyUI\execution.py", line 65, in map_node_over_list
results.append(getattr(obj, func)(**input_data_all))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Cui\cu_121_2\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-0246\nodes.py", line 1296, in execute
return junction_impl(self, _id, _prompt, _workflow, gather_junction_impl(_junc_in, _id), _offset, _in_mode = True, _out_mode = True, _offset_mode = True, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Cui\cu_121_2\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-0246\nodes.py", line 220, in junction_impl
raise Exception(f"Type \"{elem['type']}\" of output \"{elem['name']}\" does not available in junction.")

@JorgeR81
Copy link

I also noticed that in some cases the * seems to be able to replace COMBO, successfully.

Here I'm connecting a Merge node and Anything Everywhere? node.

The connection is named *, and the AE? node is able to broadcast the data, to the Highway Bach node.

hb

@JorgeR81
Copy link

I've made a [ sampler x scheduler ] version of this workflow, with different hubs.

But when I load the workflow, the 2 hubs that use BATCH_COMBO are allways disconnected.

Is this a bug, or am I doing something wrong ?

Oh it just a minor bug as it's related to how I implemented input/output expand stuff. It kinda annoying but hopefully easy to fix when I have time.

About the __BATCH_COMBO__ workflow ( PNG in here: #15 (comment) ),

I was able to solve the disconnecting issues with a reroute node.

b1


But I tried this workflow today again, and I have a list index out of range error.
Even without the reroute nodes.

It only works if I use a single COMBO output from the Hub node.

error

@Trung0246
Copy link
Owner

That's a separate bug I did not have time to fix it yet since it's a little bit complicated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants