Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -31,9 +31,9 @@ os.system(f'{conda_bin}/conda install nvidia/label/cuda-12.4.0::cuda-nvcc')
|
|
31 |
|
32 |
os.system(f'{conda_bin}/conda install pytorch::pytorch-cuda')
|
33 |
#os.system(f'{conda_bin}/conda install rcdr_py37::tensorrt')
|
34 |
-
subprocess.run(['sh', './hidet.sh'])
|
35 |
-
import hidet
|
36 |
-
print(dir(hidet))
|
37 |
|
38 |
import random
|
39 |
import uuid
|
@@ -194,11 +194,12 @@ def load_and_prepare_model():
|
|
194 |
|
195 |
#pipe.unet.to(memory_format=torch.channels_last)
|
196 |
#pipe.enable_vae_tiling()
|
197 |
-
|
|
|
198 |
pipe.to(device=device, dtype=torch.bfloat16)
|
199 |
|
200 |
return pipe
|
201 |
-
|
202 |
hidet.option.parallel_build(True)
|
203 |
hidet.option.parallel_tune(2,2.0)
|
204 |
torch._dynamo.config.suppress_errors = True
|
@@ -215,7 +216,7 @@ hidet.option.cache_dir("local_cache")
|
|
215 |
# use tensorcore
|
216 |
hidet.torch.dynamo_config.use_tensor_core()
|
217 |
hidet.torch.dynamo_config.steal_weights(False)
|
218 |
-
|
219 |
# Preload and compile both models
|
220 |
|
221 |
pipe = load_and_prepare_model()
|
|
|
31 |
|
32 |
os.system(f'{conda_bin}/conda install pytorch::pytorch-cuda')
|
33 |
#os.system(f'{conda_bin}/conda install rcdr_py37::tensorrt')
|
34 |
+
#subprocess.run(['sh', './hidet.sh'])
|
35 |
+
#import hidet
|
36 |
+
#print(dir(hidet))
|
37 |
|
38 |
import random
|
39 |
import uuid
|
|
|
194 |
|
195 |
#pipe.unet.to(memory_format=torch.channels_last)
|
196 |
#pipe.enable_vae_tiling()
|
197 |
+
#pipe.unet = torch.compile(pipe.unet, backend="hidet")
|
198 |
+
pipe.unet = torch.compile(pipe.unet, backend="torch_tensorrt", dynamic=False)
|
199 |
pipe.to(device=device, dtype=torch.bfloat16)
|
200 |
|
201 |
return pipe
|
202 |
+
'''
|
203 |
hidet.option.parallel_build(True)
|
204 |
hidet.option.parallel_tune(2,2.0)
|
205 |
torch._dynamo.config.suppress_errors = True
|
|
|
216 |
# use tensorcore
|
217 |
hidet.torch.dynamo_config.use_tensor_core()
|
218 |
hidet.torch.dynamo_config.steal_weights(False)
|
219 |
+
'''
|
220 |
# Preload and compile both models
|
221 |
|
222 |
pipe = load_and_prepare_model()
|