Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,8 @@
|
|
6 |
# copies of the Software, and to permit persons to whom the Software is
|
7 |
import spaces
|
8 |
import os
|
9 |
-
|
|
|
10 |
import random
|
11 |
import uuid
|
12 |
import gradio as gr
|
@@ -153,14 +154,14 @@ def load_and_prepare_model():
|
|
153 |
pipe.watermark=None
|
154 |
pipe.safety_checker=None
|
155 |
|
156 |
-
|
157 |
pipe.vae.requires_grad_(False)
|
158 |
pipe.unet.requires_grad_(False)
|
159 |
pipe.text_encoder.requires_grad_(False)
|
160 |
pipe.unet.eval()
|
161 |
pipe.vae.eval()
|
162 |
pipe.text_encoder.eval()
|
163 |
-
|
164 |
|
165 |
pipe.unet = pipe.unet.to(memory_format=torch.contiguous_format)
|
166 |
|
@@ -172,7 +173,7 @@ def load_and_prepare_model():
|
|
172 |
return pipe
|
173 |
|
174 |
hidet.option.parallel_build(True)
|
175 |
-
hidet.option.parallel_tune(
|
176 |
#hidet.torch.dynamo_config.steal_weights(False)
|
177 |
torch._dynamo.config.suppress_errors = True
|
178 |
torch._dynamo.disallow_in_graph(diffusers.models.attention.BasicTransformerBlock)
|
|
|
6 |
# copies of the Software, and to permit persons to whom the Software is
|
7 |
import spaces
|
8 |
import os
|
9 |
+
import subprocess
|
10 |
+
subprocess.run(['sh', './conda.sh'])
|
11 |
import random
|
12 |
import uuid
|
13 |
import gradio as gr
|
|
|
154 |
pipe.watermark=None
|
155 |
pipe.safety_checker=None
|
156 |
|
157 |
+
''' # Freeze vae and unet
|
158 |
pipe.vae.requires_grad_(False)
|
159 |
pipe.unet.requires_grad_(False)
|
160 |
pipe.text_encoder.requires_grad_(False)
|
161 |
pipe.unet.eval()
|
162 |
pipe.vae.eval()
|
163 |
pipe.text_encoder.eval()
|
164 |
+
'''
|
165 |
|
166 |
pipe.unet = pipe.unet.to(memory_format=torch.contiguous_format)
|
167 |
|
|
|
173 |
return pipe
|
174 |
|
175 |
hidet.option.parallel_build(True)
|
176 |
+
hidet.option.parallel_tune(4,1.5)
|
177 |
#hidet.torch.dynamo_config.steal_weights(False)
|
178 |
torch._dynamo.config.suppress_errors = True
|
179 |
torch._dynamo.disallow_in_graph(diffusers.models.attention.BasicTransformerBlock)
|