Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ os.environ["PATH"] = conda_bin + os.pathsep + os.environ["PATH"]
|
|
20 |
# Activate the base environment (adjust if needed)
|
21 |
os.system(f'{conda_bin}/conda init --all')
|
22 |
os.system(f'{conda_bin}/conda activate base')
|
23 |
-
|
24 |
os.system(f'{conda_bin}/conda install nvidia/label/cuda-12.4.0::cuda-libraries')
|
25 |
os.system(f'{conda_bin}/conda install nvidia/label/cuda-12.4.0::cuda-libraries-dev')
|
26 |
os.system(f'{conda_bin}/conda install nvidia/label/cuda-12.4.0::cuda-cudart')
|
@@ -34,6 +34,7 @@ os.system(f'{conda_bin}/conda install nvidia/label/cuda-12.4.0::cuda-nvcc')
|
|
34 |
#subprocess.run(['sh', './hidet.sh'])
|
35 |
import hidet
|
36 |
#print(dir(hidet))
|
|
|
37 |
|
38 |
import random
|
39 |
import uuid
|
@@ -194,8 +195,9 @@ def load_and_prepare_model():
|
|
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="cudagraphs", dynamic=False)
|
|
|
199 |
pipe.to(device=device, dtype=torch.bfloat16)
|
200 |
|
201 |
return pipe
|
|
|
20 |
# Activate the base environment (adjust if needed)
|
21 |
os.system(f'{conda_bin}/conda init --all')
|
22 |
os.system(f'{conda_bin}/conda activate base')
|
23 |
+
os.system(f'{conda_bin}/conda install nvidia/label/cudnn-9.3.0::cudnn')
|
24 |
os.system(f'{conda_bin}/conda install nvidia/label/cuda-12.4.0::cuda-libraries')
|
25 |
os.system(f'{conda_bin}/conda install nvidia/label/cuda-12.4.0::cuda-libraries-dev')
|
26 |
os.system(f'{conda_bin}/conda install nvidia/label/cuda-12.4.0::cuda-cudart')
|
|
|
34 |
#subprocess.run(['sh', './hidet.sh'])
|
35 |
import hidet
|
36 |
#print(dir(hidet))
|
37 |
+
import torch_tensorrt
|
38 |
|
39 |
import random
|
40 |
import uuid
|
|
|
195 |
|
196 |
#pipe.unet.to(memory_format=torch.channels_last)
|
197 |
#pipe.enable_vae_tiling()
|
198 |
+
#pipe.unet = torch.compile(pipe.unet, backend="hidet")
|
199 |
#pipe.unet = torch.compile(pipe.unet, backend="cudagraphs", dynamic=False)
|
200 |
+
pipe.unet = torch.compile(pipe.unet, backend="torch_tensorrt", dynamic=False, options={"precision": torch.bfloat16,"optimization_level": 4,})
|
201 |
pipe.to(device=device, dtype=torch.bfloat16)
|
202 |
|
203 |
return pipe
|