question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`seed` missing from `StableDiffusionPipeline()` v2*?

See original GitHub issue

It appears that the seed argument is missing from v2* of StableDiffusionPipeline().

https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py#L397

If this is correct, I recommend editing the generator: Optional[torch.Generator] = None to include the option of a user-defined seed, such as generator: Optional[torch.Generator().manual_seed(seed)] = None, where the seed value is a separate argument for the StableDiffusionPipeline() __call__() and seed: int = None is the default. This change will enable the reproducible generation of outputs from the same input parameters.

https://pytorch.org/docs/stable/generated/torch.Generator.html

Thanks!

Issue Analytics

  • State:open
  • Created 9 months ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
averadcommented, Dec 15, 2022

Try:

generator = torch.Generator(device="cuda").manual_seed(8)
image = pipeline(prompt, generator=generator).images[0]

https://huggingface.co/docs/diffusers/main/en/using-diffusers/schedulers#access-the-scheduler

1reaction
patrickvonplatencommented, Dec 20, 2022

Also linking this doc page on generating the same output batched vs. non-batched with a reproducible seed: https://huggingface.co/docs/diffusers/using-diffusers/reusing_seeds

Read more comments on GitHub >

github_iconTop Results From Across the Web

`seed` missing from `StableDiffusionPipeline()` v2 - PullAnswer
It appears that the seed argument is missing from v2* of StableDiffusionPipeline() . ... If this is correct, I recommend editing the generator: ......
Read more >
Same seed produces different results · Issue #1339 - GitHub
Describe the bug Basically is you set the scheduler to EulerAncestralDiscreteScheduler and the custom pipeline to lpw_stable_diffusion you will get ...
Read more >
Stable Diffusion with Diffusers - Hugging Face
Let's try out running the pipeline with less denoising steps. import torch generator = torch.Generator("cuda").manual_seed(1024) image = pipe( ...
Read more >
Mini-Guide to installing Stable-Diffusion : r/deepdream - Reddit
Step 2: Download the cloned repo by going to ... Also it does not generate a random seed, so modify --seed and type...
Read more >
Stable Diffusion Seeds: (EXPLAINED!!) - YouTube
Seeds were confusing at first, but once you get the gist, they're extremely awesome! Here's the crash course on seeds in 2 minutes-!...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found