Created
January 30, 2025 10:35
-
-
Save e96031413/fe7a7194c3c097bb390b59838b4a2a42 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler | |
model_id = "stabilityai/stable-diffusion-2" | |
# Use the Euler scheduler here instead | |
scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler") | |
pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, torch_dtype=torch.float16) | |
pipe = pipe.to("cuda") | |
prompt = "a photo of an astronaut riding a horse on mars" | |
image = pipe(prompt).images[0] | |
image.save("astronaut_rides_horse.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment