Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,8 @@
|
|
5 |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
6 |
# copies of the Software, and to permit persons to whom the Software is
|
7 |
import spaces
|
|
|
|
|
8 |
import os
|
9 |
import random
|
10 |
import uuid
|
@@ -112,10 +114,14 @@ def load_and_prepare_model():
|
|
112 |
#pipe.unet.to(memory_format=torch.channels_last)
|
113 |
#pipe.enable_vae_tiling()
|
114 |
pipe.to(device=device, dtype=torch.bfloat16)
|
115 |
-
pipe.vae = vaeXL
|
116 |
|
117 |
pipe.unet.set_attn_processor(AttnProcessor2_0())
|
118 |
pipe.vae.set_default_attn_processor()
|
|
|
|
|
|
|
|
|
119 |
return pipe
|
120 |
|
121 |
pipe = load_and_prepare_model()
|
|
|
5 |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
6 |
# copies of the Software, and to permit persons to whom the Software is
|
7 |
import spaces
|
8 |
+
|
9 |
+
|
10 |
import os
|
11 |
import random
|
12 |
import uuid
|
|
|
114 |
#pipe.unet.to(memory_format=torch.channels_last)
|
115 |
#pipe.enable_vae_tiling()
|
116 |
pipe.to(device=device, dtype=torch.bfloat16)
|
117 |
+
pipe.vae = vaeXL.to(device) #.to('cpu') #.to(torch.bfloat16)
|
118 |
|
119 |
pipe.unet.set_attn_processor(AttnProcessor2_0())
|
120 |
pipe.vae.set_default_attn_processor()
|
121 |
+
|
122 |
+
# Enable attention slicing
|
123 |
+
pipe.enable_attention_slicing()
|
124 |
+
|
125 |
return pipe
|
126 |
|
127 |
pipe = load_and_prepare_model()
|