Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -20,12 +20,14 @@ 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 |
-
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')
|
27 |
-
os.system(f'{conda_bin}/conda install nvidia/label/cuda-12.4.0::cuda-cudart-dev')
|
28 |
-
os.system(f'{conda_bin}/conda install nvidia/label/cuda-12.4.0::cuda-nvcc')
|
|
|
|
|
29 |
#subprocess.run(['pip', 'install', 'git+https://github.com/hidet-org/hidet.git'])
|
30 |
#subprocess.run(['pip', 'install', 'git+https://github.com/ford442/hidet.git@thread'])
|
31 |
|
@@ -35,7 +37,7 @@ os.system(f'{conda_bin}/conda install nvidia/label/cuda-12.4.0::cuda-nvcc')
|
|
35 |
subprocess.run(['sh', './modelopt.sh'])
|
36 |
import hidet
|
37 |
#print(dir(hidet))
|
38 |
-
import torch_tensorrt
|
39 |
|
40 |
import random
|
41 |
import uuid
|
@@ -196,9 +198,10 @@ def load_and_prepare_model():
|
|
196 |
|
197 |
#pipe.unet.to(memory_format=torch.channels_last)
|
198 |
#pipe.enable_vae_tiling()
|
|
|
199 |
#pipe.unet = torch.compile(pipe.unet, backend="hidet")
|
200 |
#pipe.unet = torch.compile(pipe.unet, backend="cudagraphs", dynamic=False)
|
201 |
-
pipe.unet = torch.compile(pipe.unet, backend="torch_tensorrt", dynamic=False, options={"precision": torch.bfloat16,"optimization_level": 4,})
|
202 |
pipe.to(device=device, dtype=torch.bfloat16)
|
203 |
|
204 |
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')
|
27 |
+
#os.system(f'{conda_bin}/conda install nvidia/label/cuda-12.4.0::cuda-cudart-dev')
|
28 |
+
#os.system(f'{conda_bin}/conda install nvidia/label/cuda-12.4.0::cuda-nvcc')
|
29 |
+
os.system(f'{conda_bin}/conda install nvidia/label/cuda-12.4.0::cuda-toolkit')
|
30 |
+
|
31 |
#subprocess.run(['pip', 'install', 'git+https://github.com/hidet-org/hidet.git'])
|
32 |
#subprocess.run(['pip', 'install', 'git+https://github.com/ford442/hidet.git@thread'])
|
33 |
|
|
|
37 |
subprocess.run(['sh', './modelopt.sh'])
|
38 |
import hidet
|
39 |
#print(dir(hidet))
|
40 |
+
#import torch_tensorrt
|
41 |
|
42 |
import random
|
43 |
import uuid
|
|
|
198 |
|
199 |
#pipe.unet.to(memory_format=torch.channels_last)
|
200 |
#pipe.enable_vae_tiling()
|
201 |
+
pipe.unet = torch.compile(pipe.unet, backend="hidet", dynamic=False, options={"precision": torch.bfloat16,"optimization_level": 4,})
|
202 |
#pipe.unet = torch.compile(pipe.unet, backend="hidet")
|
203 |
#pipe.unet = torch.compile(pipe.unet, backend="cudagraphs", dynamic=False)
|
204 |
+
#pipe.unet = torch.compile(pipe.unet, backend="torch_tensorrt", dynamic=False, options={"precision": torch.bfloat16,"optimization_level": 4,})
|
205 |
pipe.to(device=device, dtype=torch.bfloat16)
|
206 |
|
207 |
return pipe
|