Update app.py
Browse files
app.py
CHANGED
@@ -28,24 +28,24 @@ import sys
|
|
28 |
import tempfile
|
29 |
from huggingface_hub import hf_hub_download
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
#
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
#
|
47 |
-
|
48 |
-
|
49 |
|
50 |
import shutil
|
51 |
|
@@ -68,7 +68,7 @@ def find_cuda():
|
|
68 |
|
69 |
|
70 |
|
71 |
-
|
72 |
|
73 |
cuda_path = find_cuda()
|
74 |
|
|
|
28 |
import tempfile
|
29 |
from huggingface_hub import hf_hub_download
|
30 |
|
31 |
+
def install_cuda_toolkit():
|
32 |
+
print("==> install cuda 118")
|
33 |
+
# CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
|
34 |
+
CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
|
35 |
+
CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
|
36 |
+
subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
|
37 |
+
subprocess.call(["chmod", "+x", CUDA_TOOLKIT_FILE])
|
38 |
+
subprocess.call([CUDA_TOOLKIT_FILE, "--silent", "--toolkit"])
|
39 |
|
40 |
+
os.environ["CUDA_HOME"] = "/usr/local/cuda"
|
41 |
+
os.environ["PATH"] = "%s/bin:%s" % (os.environ["CUDA_HOME"], os.environ["PATH"])
|
42 |
+
os.environ["LD_LIBRARY_PATH"] = "%s/lib:%s" % (
|
43 |
+
os.environ["CUDA_HOME"],
|
44 |
+
"" if "LD_LIBRARY_PATH" not in os.environ else os.environ["LD_LIBRARY_PATH"],
|
45 |
+
)
|
46 |
+
# Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
|
47 |
+
os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
|
48 |
+
print("==> finfish install")
|
49 |
|
50 |
import shutil
|
51 |
|
|
|
68 |
|
69 |
|
70 |
|
71 |
+
install_cuda_toolkit()
|
72 |
|
73 |
cuda_path = find_cuda()
|
74 |
|