|
|
|
from diffusers import DPMSolverMultistepScheduler, StableDiffusionXLPipeline, DPMSolverSDEScheduler |
|
import hf_image_uploader as hiu |
|
import torch |
|
|
|
path = "stabilityai/stable-diffusion-xl-base-1.0" |
|
vae_path = "madebyollin/sdxl-vae-fp16-fix" |
|
|
|
|
|
|
|
pipe = StableDiffusionXLPipeline.from_pretrained(path, torch_dtype=torch.float16, variant="fp16", use_safetensors=True) |
|
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config, algorithm_type="sde-dpmsolver++") |
|
pipe.to("cuda") |
|
|
|
prompt = "An astronaut riding a green horse on Mars" |
|
steps = 20 |
|
|
|
for i in range(2): |
|
width = 512 * (i + 1) |
|
height = 512 * (i + 1) |
|
image = pipe(prompt=prompt, width=width, height=height, num_inference_steps=steps).images[0] |
|
hiu.upload(image, "patrickvonplaten/images") |
|
|
|
pipe.scheduler = DPMSolverSDEScheduler.from_config(pipe.scheduler.config, algorithm_type="sde-dpmsolver++") |
|
|
|
for i in range(2): |
|
width = 512 * (i + 1) |
|
height = 512 * (i + 1) |
|
image = pipe(prompt=prompt, width=width, height=height, num_inference_steps=steps).images[0] |
|
hiu.upload(image, "patrickvonplaten/images") |
|
|