Commit ·
a18bffa
1
Parent(s): 981eadf
update
Browse files
app.py
CHANGED
|
@@ -3,15 +3,11 @@ import spaces
|
|
| 3 |
import os
|
| 4 |
import subprocess
|
| 5 |
import torch
|
|
|
|
|
|
|
| 6 |
print(torch.__version__)
|
| 7 |
print(torch.version.cuda)
|
| 8 |
|
| 9 |
-
os.system('mkdir -p /home/user/app/tmp/.X11-unix')
|
| 10 |
-
os.system('chmod 1777 /home/user/app/tmp/.X11-unix')
|
| 11 |
-
os.environ["TMPDIR"] = "/home/user/app/tmp"
|
| 12 |
-
os.environ["DISPLAY"] = ":0.0"
|
| 13 |
-
os.system('Xvfb :0 -screen 0 640x480x24 -fp /home/user/app/tmp/.X11-unix &')
|
| 14 |
-
|
| 15 |
# download model
|
| 16 |
print("Downloading model weights")
|
| 17 |
os.system('wget -q https://huggingface.co/ThunderVVV/HaWoR/resolve/main/external/metric_depth_vit_large_800k.pth -P ./thirdparty/Metric3D/weights/')
|
|
@@ -23,8 +19,6 @@ os.system('wget -q https://huggingface.co/ThunderVVV/HaWoR/resolve/main/hawor/mo
|
|
| 23 |
|
| 24 |
|
| 25 |
def install_cuda_toolkit():
|
| 26 |
-
# CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
|
| 27 |
-
# CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
|
| 28 |
CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda_12.1.0_530.30.02_linux.run"
|
| 29 |
CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
|
| 30 |
subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
|
|
@@ -37,7 +31,6 @@ def install_cuda_toolkit():
|
|
| 37 |
os.environ["CUDA_HOME"],
|
| 38 |
"" if "LD_LIBRARY_PATH" not in os.environ else os.environ["LD_LIBRARY_PATH"],
|
| 39 |
)
|
| 40 |
-
# Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
|
| 41 |
os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
|
| 42 |
|
| 43 |
|
|
|
|
| 3 |
import os
|
| 4 |
import subprocess
|
| 5 |
import torch
|
| 6 |
+
|
| 7 |
+
print("check torch and cuda version, they must be 2.4.0 + 12.1:")
|
| 8 |
print(torch.__version__)
|
| 9 |
print(torch.version.cuda)
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
# download model
|
| 12 |
print("Downloading model weights")
|
| 13 |
os.system('wget -q https://huggingface.co/ThunderVVV/HaWoR/resolve/main/external/metric_depth_vit_large_800k.pth -P ./thirdparty/Metric3D/weights/')
|
|
|
|
| 19 |
|
| 20 |
|
| 21 |
def install_cuda_toolkit():
|
|
|
|
|
|
|
| 22 |
CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda_12.1.0_530.30.02_linux.run"
|
| 23 |
CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
|
| 24 |
subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
|
|
|
|
| 31 |
os.environ["CUDA_HOME"],
|
| 32 |
"" if "LD_LIBRARY_PATH" not in os.environ else os.environ["LD_LIBRARY_PATH"],
|
| 33 |
)
|
|
|
|
| 34 |
os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
|
| 35 |
|
| 36 |
|