comfyanonymous / ComfyUI

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface.
https://www.comfy.org/
GNU General Public License v3.0
53.8k stars 5.71k forks source link

The seed should be a global setting #278

Open PladsElsker opened 1 year ago

WASasquatch commented 1 year ago

Why? There are possibly multiple facets you may want to seed individually. For example custom nodes. I have a few that rely on seeds for different things, for example, you may want random seeds for a processing task but keeping diffusion seed the same because you're viewing the results of changes with other nodes.

PladsElsker commented 1 year ago

I agree with you that the way to set seeds shouldn't change. Setting them manually to "randomize after every gen" or to "keep last seed" for each part of the pipeline you're running is very usefull.

I'll try to sum up the other point of view as best as I can, correct me if I'm wrong. @comfyanonymous was saying that if you think about it as a premade pipeline you're running through a script, it makes sense to chose this behaviour for all the seeds of the pipeline. It's a little bit as if one pipeline became a node on its own.

If my understanding of running pipeline through the API is correct, you can change all the seed behaviour in the JSON file simply by search and replace. Maybe that would be the place to do it?

What do you think?

WASasquatch commented 1 year ago

Why would we have people have to change JSON files and use the API to change individual seeds? That seems very counter intuitive.

Additionally node editors should not be seen as one whole thing. I don't know where this is coming from. They're inherently meant to be modular graphs of many tasks combined into a workflow. Things you can't do with per-configured setups, like global seeds.

Node editors are supposed to represent base functions, allowing you to have all the flexibility of code, without coding it. For example in static software, where you may see something like a static global seed, a node editor would be an advanced feature allowing you to bypass this hard-set functionality.

PladsElsker commented 1 year ago

Yes that's what I think as well to some extent. I was just saying that like, if you want to set all the seed behaviours globaly before running it throught the API, you can probably do it with search and replace. It should be really easy to automate before running any pipeline.

Again, this is assuming I understand well the other point of view.

WASasquatch commented 1 year ago

I think this is why there is now optional input for the seed input, so you can use a single INT and input it into any seed input, effectively having a global seed. This is how things would be done in a node network, and should be.

Many custom node setups have INTs, like Derfuru math nodes, and my WAS Node Suite, and now Comfy UI has ability convert a seed to input and use primitive.

Screenshot_43

Screenshot_44

image

jordanbtucker commented 1 year ago

You can use a single INT and input it into any seed input, effectively having a global seed.

This is my take on it. I don't see the need for a global setting when you can just make your random values scoped where you want. Instead of only per-node or global, you get anywhere in between too.

Void2258 commented 1 year ago

You can use a single INT and input it into any seed input, effectively having a global seed.

This is my take on it. I don't see the need for a global setting when you can just make your random values scoped where you want. Instead of only per-node or global, you get anywhere in between too.

The issue, as slightly visible in WASasquatc 3rd example image, is that this can get very hard to track (wire forest). Perhaps giving various nodes the ability to optionally output the seed they were given to be passed along might help keep it cleaner and clearer.

WASasquatch commented 1 year ago

Try out the reroute node. This is just how node networks work. They're a node tree, literally. We shouldn't be trying to rework the wheel on what a node system is.

Instead this falls back on the idea I mentioned about a GUI and Node Editor system. Where the GUI expects and acts on certain required nodes like sampler and such, and allows any editing in-between in node system, but the GUI can handle presentation better, like a place to load input images, see output images in a folder 📂 system, see a list of nodes and normal settings like window that shows with each node select in list, etc, etc.

In a system like this a seed field and "populate all seed instances" button would be right at home 👍

gobshyte commented 1 year ago

There does not seem to be any way to reroute the seed primitive though? About the closest I've managed to get is using the WAS suite (deprecated?) Seed node, changing the seed to input and plugging the primitive into that. I can then add reroute nodes that show 'seed' problem is they can't then be connected to seed on any samplers!? I've tried using the 'random number' also from WAS suite instead of a seed primitive, and it mostly works with conversion from number to int but comes with other issues - as far as I can tell (so far, need to test more...) if you drag a png back in to recreate workflow it wors with seed primitive but not the random number generator....