mlc-ai / web-stable-diffusion

Bringing stable diffusion models to web browsers. Everything runs inside the browser with no server support.
https://mlc.ai/web-stable-diffusion
Apache License 2.0
3.56k stars 227 forks source link

Is there a way to set/change the seed in runtime? #41

Closed jdp8 closed 1 year ago

jdp8 commented 1 year ago

I've been playing around with the code and have been trying to set my own seed to control the image outputs but have not had any luck so far. Any clue or information that could put me in the right path would be greatly appreciated! Thank you

jdp8 commented 1 year ago

After a little research I found that the initial random latent is created using the Math.random() function which cannot be seeded as mentioned in the first paragraph of the documentation. The solution was to change this function with another Random Number Generator (RNG) that can be seeded. In my case, I used seedrandom but there are other RNGs that can be seeded as well.