File size: 911 Bytes
69f6fc2 4861382 78ed83d 69f6fc2 b6badad 69f6fc2 4861382 69f6fc2 6d8ff37 4861382 a032108 6d8ff37 4861382 a032108 4861382 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
#!/usr/bin/env python3
from diffusers import (
SASolverScheduler,
StableDiffusionPipeline,
KDPM2DiscreteScheduler,
StableDiffusionImg2ImgPipeline,
HeunDiscreteScheduler,
KDPM2AncestralDiscreteScheduler,
DDIMScheduler,
)
import time
import torch
import sys
from pathlib import Path
# path = sys.argv[1]
path = "runwayml/stable-diffusion-v1-5"
device = "mps"
pipe = StableDiffusionPipeline.from_pretrained(path, torch_dtype=torch.float16)
pipe.scheduler = SASolverScheduler.from_config(pipe.scheduler.config)
pipe.to(device)
prompt = "A lion in galaxies, spirals, nebulae, stars, smoke, iridescent, intricate detail, octane render, 8k"
start_time = time.time()
generator = torch.Generator(device=device).manual_seed(0)
images = pipe(
prompt=prompt, generator=generator, num_images_per_prompt=1, num_inference_steps=30
).images
print(time.time() - start_time)
images[0].show()
|