mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-08-04 03:10:21 +00:00
Option to use CPU for random number generation.
Makes a given manual seed generate the same images across different platforms, independently of the GPU architecture in use. Fixes #9613.
This commit is contained in:
@@ -60,3 +60,12 @@ def store_latent(decoded):
|
||||
|
||||
class InterruptedException(BaseException):
|
||||
pass
|
||||
|
||||
if opts.use_cpu_randn:
|
||||
import torchsde._brownian.brownian_interval
|
||||
|
||||
def torchsde_randn(size, dtype, device, seed):
|
||||
generator = torch.Generator(devices.cpu).manual_seed(int(seed))
|
||||
return torch.randn(size, dtype=dtype, device=devices.cpu, generator=generator).to(device)
|
||||
|
||||
torchsde._brownian.brownian_interval._randn = torchsde_randn
|
||||
|
Reference in New Issue
Block a user