Last active
November 27, 2022 01:24
-
-
Save 0xBigBoss/555b7190cbdd083a405bdade33a4c7df 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
# pip install diffusers transformers accelerate | |
# Load model | |
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler | |
import torch | |
repo_id = "stabilityai/stable-diffusion-2" | |
device = "cuda" | |
pipe = DiffusionPipeline.from_pretrained(repo_id, torch_dtype=torch.float16, revision="fp16") | |
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config) | |
pipe = pipe.to(device) | |
# Generate your image | |
prompt = "High quality photo of an astronaut riding a horse in space" | |
pipe(prompt, guidance_scale=9).images[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment