from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler | |
import torch | |
repo_id = "stabilityai/stable-diffusion-2-base" | |
pipe = DiffusionPipeline.from_pretrained(repo_id, torch_dtype=torch.float16, revision="fp16") | |
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config) | |
pipe = pipe.to("cuda") | |
prompt = "High quality photo of an astronaut riding a horse in space" | |
image = pipe(prompt, num_inference_steps=25).images[0] | |
image.save("astronaut.png") |