Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,28 +28,28 @@ import subprocess
|
|
| 28 |
|
| 29 |
# def sh(cmd): subprocess.check_call(cmd, shell=True)
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
#
|
| 45 |
-
|
| 46 |
-
|
| 47 |
|
| 48 |
-
|
|
|
|
|
|
|
| 49 |
|
| 50 |
# my_env = os.environ.copy()
|
| 51 |
-
subprocess.run(["apt-get", "update"], check=True)
|
| 52 |
-
subprocess.run(["apt-get", "install", "cuda-toolkit-12-6"], check=True)
|
| 53 |
subprocess.run(["pip", "install","diso"], check=True)
|
| 54 |
|
| 55 |
|
|
|
|
| 28 |
|
| 29 |
# def sh(cmd): subprocess.check_call(cmd, shell=True)
|
| 30 |
|
| 31 |
+
def install_cuda_toolkit():
|
| 32 |
+
CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.6.0/local_installers/cuda_12.6.0_560.28.03_linux.run"
|
| 33 |
+
CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
|
| 34 |
+
subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
|
| 35 |
+
subprocess.call(["chmod", "+x", CUDA_TOOLKIT_FILE])
|
| 36 |
+
subprocess.call([CUDA_TOOLKIT_FILE, "--silent", "--toolkit"])
|
| 37 |
+
|
| 38 |
+
os.environ["CUDA_HOME"] = "/usr/local/cuda"
|
| 39 |
+
os.environ["PATH"] = "%s/bin:%s" % (os.environ["CUDA_HOME"], os.environ["PATH"])
|
| 40 |
+
os.environ["LD_LIBRARY_PATH"] = "%s/lib:%s" % (
|
| 41 |
+
os.environ["CUDA_HOME"],
|
| 42 |
+
"" if "LD_LIBRARY_PATH" not in os.environ else os.environ["LD_LIBRARY_PATH"],
|
| 43 |
+
)
|
| 44 |
+
# Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
|
| 45 |
+
os.environ["TORCH_CUDA_ARCH_LIST"] = "9.0"
|
| 46 |
+
print("==> finished installation")
|
| 47 |
|
| 48 |
+
install_cuda_toolkit()
|
| 49 |
+
|
| 50 |
+
print(os.environ["CUDA_HOME"])
|
| 51 |
|
| 52 |
# my_env = os.environ.copy()
|
|
|
|
|
|
|
| 53 |
subprocess.run(["pip", "install","diso"], check=True)
|
| 54 |
|
| 55 |
|