Skip to content

Instantly share code, notes, and snippets.

@ryanwebster90
Last active September 23, 2023 15:49
Show Gist options
  • Save ryanwebster90/cb47ba9f790c6e7d74c8236fc83e01a1 to your computer and use it in GitHub Desktop.
Save ryanwebster90/cb47ba9f790c6e7d74c8236fc83e01a1 to your computer and use it in GitHub Desktop.
from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler
import torch
scheduler = EulerDiscreteScheduler(use_karras_sigmas=True)
pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5",scheduler=scheduler, torch_dtype=torch.float16)
generator = torch.Generator("cuda").manual_seed(0)
pipe = pipe.to('cuda')
image = pipe("a golden retriever",num_inference_steps=30,generator=generator).images[0]
image.save('test.jpg')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment