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

Add optional noise_seed to make augmentation deterministic #3275

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

Conversation

harelc
Copy link

@harelc harelc commented Apr 17, 2024

As currently implemented, SVD_img2vid_Conditioning has an optional augmentation stage with non-deterministic noising of the conditioning image, which prevents one from reproducing exact results in an SVD pipeline if augmentation is used.

I'm suggesting an optional (change widget to input port to ignore) noise_seed for the augmentation stage.

@harelc harelc requested a review from comfyanonymous as a code owner April 17, 2024 09:57
@comfyanonymous
Copy link
Owner

A more proper way is doing it with a generator like this: https://github.com/comfyanonymous/ComfyUI/blob/master/comfy/sample.py#L13

@harelc
Copy link
Author

harelc commented Apr 18, 2024

@comfyanonymous changed as requested. This kind of mandates the seed to be a required, not optional, argument, so I changed accordingly.

@asagi4
Copy link
Contributor

asagi4 commented Apr 18, 2024

@harelc the generator can be None when no seed is supplied and it'll use the "global" RNG.

@harelc
Copy link
Author

harelc commented Apr 21, 2024

@asagi4 ok, did as you suggested.

RETURN_TYPES = ("CONDITIONING", "CONDITIONING", "LATENT")
RETURN_NAMES = ("positive", "negative", "latent")

FUNCTION = "encode"

CATEGORY = "conditioning/video_models"

def encode(self, clip_vision, init_image, vae, width, height, video_frames, motion_bucket_id, fps, augmentation_level):
def encode(self, clip_vision, init_image, vae, width, height, video_frames, motion_bucket_id,
fps, augmentation_level, noise_seed=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

[minor] this shouldn't have the line break here

}}
"augmentation_level": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 10.0, "step": 0.01}),
},
"optional": { "noise_seed": ("INT", {"default": 0, "min": 0, "max": 2**32-1})
Copy link
Contributor

Choose a reason for hiding this comment

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

the seed max value as seen in eg the KSampler node should be set as 0xffffffffffffffff

@mcmonkey4eva mcmonkey4eva added Bug Something is confirmed to not be working properly. Feature A new feature to add to ComfyUI. Good PR This PR looks good to go, it needs comfy's final review. labels Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is confirmed to not be working properly. Feature A new feature to add to ComfyUI. Good PR This PR looks good to go, it needs comfy's final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants