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

Uniform, Scheduled and randomized seeds depending on list or INT input #2129

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

FizzleDorf
Copy link
Contributor

This PR allows lists of seed values to determine what seed is used for latents in a batch. Below are some examples of how to use this.
note: I am using my own custom node for this but you can use any node that outputs lists of ints to test

Randomize every latent after the first if it's an int:
single seed

Uniform seeds using a list of seeds at 0:
uniform seeds

Scheduled seeds for specifying which latent should have a particular seed:
scheduled seeds

There was legacy code for doing this but it isn't very "plug and play". This alternative is pretty straight forward. Feel free to make any edits you feel are needed.

this image has the workflow I used for testing:
ComfyUI_00001_

@FizzleDorf FizzleDorf changed the title Uniform, Schedules and randomized seeds depending on list or INT input Uniform, Scheduled and randomized seeds depending on list or INT input Dec 1, 2023
@FizzleDorf
Copy link
Contributor Author

Added a dropdown for selecting the behaviour for seed lists smaller than the number of latents. Default is randomized.

decrement
increment
fixed
rand

@FizzleDorf
Copy link
Contributor Author

fyi, this does set values to random ints which may break old workflows. not sure there is a workaround for this.

@nathanshipley
Copy link

It seems like this works for Euler, but not Euler Ancestral. Is that expected?

@FizzleDorf
Copy link
Contributor Author

It seems like this works for Euler, but not Euler Ancestral. Is that expected?

Just want to make sure this gets answered. The reason ancestral samplers and other samplers that inject noise between timesteps is because they add random noise on their own. Fixed seed is mainly for deterministic samplers as they provide cleaner results for vid2vid workflows.

@FizzleDorf
Copy link
Contributor Author

The fixes for this PR have been implemented. The only reason the tests fail is it trips the check for adding a new option to the KSampler. The reason it's in the KSampler is for further modularity across a workflow to encourage experimentation. Increment and Decrement options also makes it easy to find the seed for a particular result in a batch you want to refine later in another workflow by adding the element's position in a batch. This is also follows suite wit the control_after_generation options. From the tests I have done with my company, it really is a hit. Feel free to test yourself with the same workflows provided earlier.

@FizzleDorf
Copy link
Contributor Author

@pythongosssss or @comfyanonymous, please remember to change the automated testing after merge so all tests later on don't error out.

@@ -1343,6 +1342,7 @@ def INPUT_TYPES(s):
"negative": ("CONDITIONING", ),
"latent_image": ("LATENT", ),
"denoise": ("FLOAT", {"default": 1.0, "min": 0.0, "max": 1.0, "step": 0.01}),
"batch_behavior": (["randomize", "fixed", "increment", "decrement"],),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would need to be under optional to avoid breaking presaved api workflows (and use ="some_default" on the func params)

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

Successfully merging this pull request may close these issues.

3 participants