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

Deterministic generation #15

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

drakfyre
Copy link

Added deterministic generation (and it works this time...)

So now you can re-generate pictures that were made with CADS! :>

@v0xie
Copy link
Owner

v0xie commented Nov 24, 2023

Hey thanks so much for this, reproducibility is a really issue this repo has yet to tackle.

When testing this PR, I'm running into an error in the latest commit:

** Error executing callback cfg_denoiser_callback for F:\stablediffusion\stable-diffusion-webui\extensions\sd-cads-cfg\scripts\cads.py
    Traceback (most recent call last):
      File "F:\stablediffusion\stable-diffusion-webui\modules\script_callbacks.py", line 216, in cfg_denoiser_callback
        c.callback(params)
      File "F:\stablediffusion\stable-diffusion-webui\extensions\sd-cads-cfg\scripts\cads.py", line 112, in <lambda>
        y = lambda params: self.on_cfg_denoiser_callback(params, t1=t1, t2=t2, noise_scale=noise_scale, mixing_factor=mixing_factor, rescale=rescale, total_sampling_steps=total_sampling_steps)
      File "F:\stablediffusion\stable-diffusion-webui\extensions\sd-cads-cfg\scripts\cads.py", line 160, in on_cfg_denoiser_callback
        rng.manual_seed(params.seed)
    AttributeError: 'CFGDenoiserParams' object has no attribute 'seed'

Previously I took a stab (unsuccessfully) at reproducing seeds in this test branch: https://github.com/v0xie/sd-webui-cads/tree/fix-rng

I was kind of worried setting the manual seed would alter existing seeds (i.e. the image that would be generated without any effect from CADS), so I tried using A111 rng.randn_local to generate the noise at each iteration, but that didn't work for me. If it's as easy as setting the manual seed I'm all for it.

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.

2 participants