Get seed for the generated image

#21
by semantics89 - opened

Hi
I love your model! Wanted to make a few consistent images with the same character. Can you help me obtain the seed number of the generated image and how do I specify it in the python? I see this is function available at your website
Cheers!

generator = torch.Generator(device='cuda')

latents = None
seeds = []
for _ in range(1):
seed = generator.seed()
seeds.append(seed)
generator = generator.manual_seed(seed)#5451612
image_latents = torch.randn(
(1, pipe.unet.in_channels, 1024 // 8, 768 // 8), #Size of photo (768x1024)
generator = generator,
device = 'cuda'
)
latents = image_latents if latents is None else torch.cat((latents, image_latents))

AND

with torch.autocast("cuda"):
image = pipe([prompt]*1, latents=latents, guidance_scale=7.5, generator=generator, num_inference_steps=100)

You can change seed from "generator.manual_seed()"

Sign up or log in to comment