File size: 1,049 Bytes
bc52061 5be41e3 dc8f6a8 |
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 35 36 37 38 |

- run with only +0.6gb total ram, with this at 192x256
- run with only +1gb total ram, with this at 320x320
```
from diffusers import StableDiffusionOnnxPipeline
import torch
from diffusers import (
DDPMScheduler,
DDIMScheduler,
PNDMScheduler,
LMSDiscreteScheduler,
EulerDiscreteScheduler,
EulerAncestralDiscreteScheduler,
DPMSolverMultistepScheduler
)
scheduler = DPMSolverMultistepScheduler.from_pretrained("./model", subfolder="scheduler")
pipe = StableDiffusionOnnxPipeline.from_pretrained(
'./model',
custom_pipeline="lpw_stable_diffusion_onnx",
revision="onnx",
scheduler=scheduler,
safety_checker=None,
provider="CPUExecutionProvider"
)
prompt = "a photo of "
neg_prompt = ""
generator = torch.Generator(device="cpu").manual_seed(1)
image = pipe.text2img(prompt,negative_prompt=neg_prompt, num_inference_steps=8, width=192, height=256, guidance_scale=10, generator=generator, max_embeddings_multiples=3).images[0]
image.save('./test.png')
``` |