|  | |
| - 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') | |
| ``` |