Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -19,9 +19,6 @@ from typing import Tuple
|
|
19 |
#from transformers import AutoTokenizer, AutoModelForCausalLM
|
20 |
import paramiko
|
21 |
|
22 |
-
from xformers.ops import MemoryEfficientAttentionFlashAttentionOp
|
23 |
-
|
24 |
-
|
25 |
#os.system("chmod +x ./cusparselt.sh")
|
26 |
#os.system("./cusparselt.sh")
|
27 |
#os.system("chmod +x ./cudnn.sh")
|
@@ -113,16 +110,14 @@ def load_and_prepare_model(model_id):
|
|
113 |
"ford442/RealVisXL_V5.0_BF16": torch.bfloat16,
|
114 |
}
|
115 |
dtype = model_dtypes.get(model_id, torch.bfloat16) # Default to float32 if not found
|
116 |
-
|
117 |
pipe = StableDiffusionXLPipeline.from_pretrained(
|
118 |
model_id,
|
119 |
torch_dtype=torch.bfloat16,
|
120 |
add_watermarker=False,
|
121 |
use_safetensors=True,
|
|
|
122 |
).to(torch.bfloat16).to('cuda')
|
123 |
-
pipe.enable_xformers_memory_efficient_attention(attention_op=MemoryEfficientAttentionFlashAttentionOp)
|
124 |
-
# Workaround for not accepting attention shape using VAE for Flash Attention
|
125 |
-
pipe.vae.enable_xformers_memory_efficient_attention(attention_op=None)
|
126 |
|
127 |
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
128 |
if ENABLE_CPU_OFFLOAD:
|
|
|
19 |
#from transformers import AutoTokenizer, AutoModelForCausalLM
|
20 |
import paramiko
|
21 |
|
|
|
|
|
|
|
22 |
#os.system("chmod +x ./cusparselt.sh")
|
23 |
#os.system("./cusparselt.sh")
|
24 |
#os.system("chmod +x ./cudnn.sh")
|
|
|
110 |
"ford442/RealVisXL_V5.0_BF16": torch.bfloat16,
|
111 |
}
|
112 |
dtype = model_dtypes.get(model_id, torch.bfloat16) # Default to float32 if not found
|
113 |
+
vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16", torch_dtype=torch.bfloat16,safety_checker=None)
|
114 |
pipe = StableDiffusionXLPipeline.from_pretrained(
|
115 |
model_id,
|
116 |
torch_dtype=torch.bfloat16,
|
117 |
add_watermarker=False,
|
118 |
use_safetensors=True,
|
119 |
+
vae=vae,
|
120 |
).to(torch.bfloat16).to('cuda')
|
|
|
|
|
|
|
121 |
|
122 |
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
123 |
if ENABLE_CPU_OFFLOAD:
|