pandora-s commited on
Commit
00acbea
·
verified ·
1 Parent(s): fcfb4eb

Create cuda_bug.py

Browse files
Files changed (1) hide show
  1. cuda_bug.py +24 -0
cuda_bug.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HIGHLY Inspired by the following solution -> https://discuss.huggingface.co/t/error-running-model-in-zerogpu/109819/3
2
+ import subprocess
3
+ import os
4
+ import sys
5
+
6
+ def install_cuda_toolkit_requirements():
7
+ # CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
8
+ CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
9
+ CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
10
+
11
+ subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
12
+ subprocess.call(["chmod", "+x", CUDA_TOOLKIT_FILE])
13
+ subprocess.call([CUDA_TOOLKIT_FILE, "--silent", "--toolkit"])
14
+
15
+ os.environ["CUDA_HOME"] = "/usr/local/cuda"
16
+ os.environ["PATH"] = "%s/bin:%s" % (os.environ["CUDA_HOME"], os.environ["PATH"])
17
+ os.environ["LD_LIBRARY_PATH"] = "%s/lib:%s" % (
18
+ os.environ["CUDA_HOME"],
19
+ "" if "LD_LIBRARY_PATH" not in os.environ else os.environ["LD_LIBRARY_PATH"],
20
+ )
21
+ # Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
22
+ os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
23
+
24
+ subprocess.run([sys.executable, "-m", "pip", "install", "-r", "more_requirements.txt"])