Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
run with only +0.6gb total ram, with this at 192x256
|
| 2 |
+
run with only +1gb total ram, with this at 320x320
|
| 3 |
+
```
|
| 4 |
+
from diffusers import StableDiffusionOnnxPipeline
|
| 5 |
+
import torch
|
| 6 |
+
from diffusers import (
|
| 7 |
+
DDPMScheduler,
|
| 8 |
+
DDIMScheduler,
|
| 9 |
+
PNDMScheduler,
|
| 10 |
+
LMSDiscreteScheduler,
|
| 11 |
+
EulerDiscreteScheduler,
|
| 12 |
+
EulerAncestralDiscreteScheduler,
|
| 13 |
+
DPMSolverMultistepScheduler
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
scheduler = DPMSolverMultistepScheduler.from_pretrained("./model", subfolder="scheduler")
|
| 17 |
+
|
| 18 |
+
pipe = StableDiffusionOnnxPipeline.from_pretrained(
|
| 19 |
+
'./model',
|
| 20 |
+
custom_pipeline="lpw_stable_diffusion_onnx",
|
| 21 |
+
revision="onnx",
|
| 22 |
+
scheduler=scheduler,
|
| 23 |
+
safety_checker=None,
|
| 24 |
+
provider="CPUExecutionProvider"
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
prompt = "a photo of "
|
| 29 |
+
neg_prompt = ""
|
| 30 |
+
|
| 31 |
+
generator = torch.Generator(device="cpu").manual_seed(1)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
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]
|
| 35 |
+
image.save('./test.png')
|
| 36 |
+
```
|