LTT commited on
Commit
65b3f7e
1 Parent(s): 7b50163

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -14
app.py CHANGED
@@ -29,20 +29,21 @@ import tempfile
29
  from huggingface_hub import hf_hub_download
30
 
31
  def install_cuda_toolkit():
32
- """
33
- Installs CUDA Toolkit 12.1 using conda.
34
- """
35
- try:
36
- print("Installing CUDA Toolkit 12.1...")
37
- # Run the conda install command
38
- subprocess.check_call([
39
- sys.executable, "-m", "conda", "install", "cuda", "-c", "nvidia/label/cuda-12.1.0", "-y"
40
- ])
41
- print("CUDA Toolkit 12.1 installed successfully.")
42
- except subprocess.CalledProcessError as e:
43
- print(f"Failed to install CUDA Toolkit: {e}")
44
- except Exception as e:
45
- print(f"An unexpected error occurred: {e}")
 
46
 
47
  install_cuda_toolkit()
48
 
 
29
  from huggingface_hub import hf_hub_download
30
 
31
  def install_cuda_toolkit():
32
+ CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
33
+ # CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
34
+ CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
35
+ subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
36
+ subprocess.call(["chmod", "+x", CUDA_TOOLKIT_FILE])
37
+ subprocess.call([CUDA_TOOLKIT_FILE, "--silent", "--toolkit"])
38
+
39
+ os.environ["CUDA_HOME"] = "/usr/local/cuda"
40
+ os.environ["PATH"] = "%s/bin:%s" % (os.environ["CUDA_HOME"], os.environ["PATH"])
41
+ os.environ["LD_LIBRARY_PATH"] = "%s/lib:%s" % (
42
+ os.environ["CUDA_HOME"],
43
+ "" if "LD_LIBRARY_PATH" not in os.environ else os.environ["LD_LIBRARY_PATH"],
44
+ )
45
+ # Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
46
+ os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
47
 
48
  install_cuda_toolkit()
49