File size: 993 Bytes
d8d872a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
from diffusers import DPMSolverMultistepScheduler, StableDiffusionXLPipeline, DPMSolverSDEScheduler
import hf_image_uploader as hiu

path = "hf-internal-testing/tiny-stable-diffusion-xl-pipe"

pipe = StableDiffusionXLPipeline.from_pretrained(path)
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config, algorithm_type="sde-dpmsolver++")

prompt = "An astronaut riding a green horse on Mars"
steps = 20

for i in range(2):
    width = 32 * (i + 1)
    height = 32 * (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 = 32 * (i + 1)
    height = 32 * (i + 1)
    image = pipe(prompt=prompt, width=width, height=height, num_inference_steps=steps).images[0]
    hiu.upload(image, "patrickvonplaten/images")