Spaces:
Running
on
Zero
Running
on
Zero
刘虹雨
commited on
Commit
·
24d7d5e
1
Parent(s):
e8296b3
update code
Browse files- app.py +4 -4
- recon/torch_utils/custom_ops.py +3 -1
app.py
CHANGED
@@ -62,7 +62,7 @@ import sys
|
|
62 |
|
63 |
os.environ["MEDIAPIPE_DISABLE_GPU"] = "1" # Disable GPU for MediaPipe
|
64 |
def install_cuda_toolkit():
|
65 |
-
CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/
|
66 |
CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
|
67 |
|
68 |
print(f"[INFO] Downloading CUDA Toolkit from {CUDA_TOOLKIT_URL} ...")
|
@@ -305,8 +305,8 @@ def prepare_working_dir(dir, style):
|
|
305 |
def launch_pretrained():
|
306 |
|
307 |
from huggingface_hub import snapshot_download
|
308 |
-
os.system("pip uninstall torch
|
309 |
-
os.system("pip uninstall torchvision
|
310 |
os.system("pip install https://download.pytorch.org/whl/cu121/torch-2.4.1%2Bcu121-cp310-cp310-linux_x86_64.whl")
|
311 |
os.system("pip install https://download.pytorch.org/whl/cu121/torchvision-0.19.1%2Bcu121-cp310-cp310-linux_x86_64.whl")
|
312 |
snapshot_download(
|
@@ -957,7 +957,7 @@ if __name__ == '__main__':
|
|
957 |
if _get_output(["nvcc", "--version"]) is None:
|
958 |
logging.info("Installing CUDA toolkit...")
|
959 |
install_cuda_toolkit()
|
960 |
-
logging.info("
|
961 |
|
962 |
else:
|
963 |
logging.info("Detected CUDA: %s" % _get_output(["nvcc", "--version"]))
|
|
|
62 |
|
63 |
os.environ["MEDIAPIPE_DISABLE_GPU"] = "1" # Disable GPU for MediaPipe
|
64 |
def install_cuda_toolkit():
|
65 |
+
CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda_12.1.0_530.30.02_linux.run"
|
66 |
CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
|
67 |
|
68 |
print(f"[INFO] Downloading CUDA Toolkit from {CUDA_TOOLKIT_URL} ...")
|
|
|
305 |
def launch_pretrained():
|
306 |
|
307 |
from huggingface_hub import snapshot_download
|
308 |
+
os.system("pip uninstall torch")
|
309 |
+
os.system("pip uninstall torchvision")
|
310 |
os.system("pip install https://download.pytorch.org/whl/cu121/torch-2.4.1%2Bcu121-cp310-cp310-linux_x86_64.whl")
|
311 |
os.system("pip install https://download.pytorch.org/whl/cu121/torchvision-0.19.1%2Bcu121-cp310-cp310-linux_x86_64.whl")
|
312 |
snapshot_download(
|
|
|
957 |
if _get_output(["nvcc", "--version"]) is None:
|
958 |
logging.info("Installing CUDA toolkit...")
|
959 |
install_cuda_toolkit()
|
960 |
+
logging.info("installCUDA: %s" % _get_output(["nvcc", "--version"]))
|
961 |
|
962 |
else:
|
963 |
logging.info("Detected CUDA: %s" % _get_output(["nvcc", "--version"]))
|
recon/torch_utils/custom_ops.py
CHANGED
@@ -19,7 +19,9 @@ import uuid
|
|
19 |
import torch
|
20 |
import torch.utils.cpp_extension
|
21 |
from torch.utils.file_baton import FileBaton
|
22 |
-
|
|
|
|
|
23 |
#----------------------------------------------------------------------------
|
24 |
# Global options.
|
25 |
|
|
|
19 |
import torch
|
20 |
import torch.utils.cpp_extension
|
21 |
from torch.utils.file_baton import FileBaton
|
22 |
+
os.environ["CUDA_HOME"] = "/usr/local/cuda"
|
23 |
+
os.environ["PATH"] = f"{os.environ['CUDA_HOME']}/bin:" + os.environ.get("PATH", "")
|
24 |
+
os.environ["LD_LIBRARY_PATH"] = f"{os.environ['CUDA_HOME']}/lib64:" + os.environ.get("LD_LIBRARY_PATH", "")
|
25 |
#----------------------------------------------------------------------------
|
26 |
# Global options.
|
27 |
|