Update app.py
Browse files
app.py
CHANGED
|
@@ -14,7 +14,7 @@ import numpy as np
|
|
| 14 |
from PIL import Image
|
| 15 |
import torch
|
| 16 |
import torch._dynamo
|
| 17 |
-
|
| 18 |
from diffusers import AutoencoderKL, StableDiffusionXLPipeline
|
| 19 |
|
| 20 |
from diffusers import EulerAncestralDiscreteScheduler
|
|
@@ -188,8 +188,15 @@ def load_and_prepare_model():
|
|
| 188 |
pipe.load_lora_weights("ford442/sdxl-vae-bf16", weight_name="LoRA/skin_texture_style_v4.safetensors", adapter_name="skin")
|
| 189 |
#pipe.unet.load_lora_adapter("ford442/sdxl-vae-bf16", weight_name="LoRA/skin_texture_style_v4.safetensors", prefix="unet")
|
| 190 |
#pipe.text_encoder.load_lora_adapter("ford442/sdxl-vae-bf16", weight_name="LoRA/skin_texture_style_v4.safetensors", prefix="text_encoder")
|
|
|
|
| 191 |
pipe.unet = pipe.unet.to(memory_format=torch.contiguous_format)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
|
|
|
|
| 193 |
#pipe.load_lora_weights("ford442/sdxl-vae-bf16", weight_name="LoRA/epicNewPhoto.safetensors", adapter_name="photo")
|
| 194 |
#pipe.set_adapters(["skin", "photo", "fantasy"], adapter_weights=[0.75, 0.25, 0.5])
|
| 195 |
#pipe.set_adapters(["skin"], adapter_weights=[0.5])
|
|
|
|
| 14 |
from PIL import Image
|
| 15 |
import torch
|
| 16 |
import torch._dynamo
|
| 17 |
+
import diffusers
|
| 18 |
from diffusers import AutoencoderKL, StableDiffusionXLPipeline
|
| 19 |
|
| 20 |
from diffusers import EulerAncestralDiscreteScheduler
|
|
|
|
| 188 |
pipe.load_lora_weights("ford442/sdxl-vae-bf16", weight_name="LoRA/skin_texture_style_v4.safetensors", adapter_name="skin")
|
| 189 |
#pipe.unet.load_lora_adapter("ford442/sdxl-vae-bf16", weight_name="LoRA/skin_texture_style_v4.safetensors", prefix="unet")
|
| 190 |
#pipe.text_encoder.load_lora_adapter("ford442/sdxl-vae-bf16", weight_name="LoRA/skin_texture_style_v4.safetensors", prefix="text_encoder")
|
| 191 |
+
|
| 192 |
pipe.unet = pipe.unet.to(memory_format=torch.contiguous_format)
|
| 193 |
+
|
| 194 |
+
#Some typical diffusers pipeline optimizations
|
| 195 |
+
# pipe.unet.to(memory_format=torch.channels_last) #Unsupported by hidet, but does not seem to make a difference if disabled.
|
| 196 |
+
#pipe.enable_vae_tiling()
|
| 197 |
+
#pipe.enable_xformers_memory_efficient_attention()
|
| 198 |
|
| 199 |
+
|
| 200 |
#pipe.load_lora_weights("ford442/sdxl-vae-bf16", weight_name="LoRA/epicNewPhoto.safetensors", adapter_name="photo")
|
| 201 |
#pipe.set_adapters(["skin", "photo", "fantasy"], adapter_weights=[0.75, 0.25, 0.5])
|
| 202 |
#pipe.set_adapters(["skin"], adapter_weights=[0.5])
|