Commit
·
8053227
1
Parent(s):
54ad393
Added vape to reduce vram usage
Browse files
app.py
CHANGED
|
@@ -1,13 +1,15 @@
|
|
| 1 |
-
from diffusers import StableDiffusionXLPipeline
|
| 2 |
import torch
|
| 3 |
#from controlnet_aux import OpenposeDetector
|
| 4 |
#from diffusers.utils import load_image
|
| 5 |
import gradio as gr
|
| 6 |
|
|
|
|
| 7 |
model_base = "stabilityai/stable-diffusion-xl-base-1.0"
|
| 8 |
|
|
|
|
| 9 |
pipe = StableDiffusionXLPipeline.from_pretrained(
|
| 10 |
-
model_base, torch_dtype=torch.float16
|
| 11 |
)
|
| 12 |
pipe = pipe.to("cuda")
|
| 13 |
|
|
|
|
| 1 |
+
from diffusers import StableDiffusionXLPipeline, AutoencoderKL
|
| 2 |
import torch
|
| 3 |
#from controlnet_aux import OpenposeDetector
|
| 4 |
#from diffusers.utils import load_image
|
| 5 |
import gradio as gr
|
| 6 |
|
| 7 |
+
|
| 8 |
model_base = "stabilityai/stable-diffusion-xl-base-1.0"
|
| 9 |
|
| 10 |
+
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
| 11 |
pipe = StableDiffusionXLPipeline.from_pretrained(
|
| 12 |
+
model_base, vae=vae, torch_dtype=torch.float16, variant="fp16", use_safetensors=True
|
| 13 |
)
|
| 14 |
pipe = pipe.to("cuda")
|
| 15 |
|