AshanGimhana commited on
Commit
14ac743
1 Parent(s): 3a9b285

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py CHANGED
@@ -3,6 +3,29 @@ import subprocess
3
 
4
  os.system("pip install gradio==3.50")
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  from argparse import Namespace
8
  import pprint
 
3
 
4
  os.system("pip install gradio==3.50")
5
 
6
+ #############################################
7
+
8
+ def install_cuda_toolkit():
9
+ # CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
10
+ CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
11
+ CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
12
+ subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
13
+ subprocess.call(["chmod", "+x", CUDA_TOOLKIT_FILE])
14
+ subprocess.call([CUDA_TOOLKIT_FILE, "--silent", "--toolkit"])
15
+
16
+ os.environ["CUDA_HOME"] = "/usr/local/cuda"
17
+ os.environ["PATH"] = "%s/bin:%s" % (os.environ["CUDA_HOME"], os.environ["PATH"])
18
+ os.environ["LD_LIBRARY_PATH"] = "%s/lib:%s" % (
19
+ os.environ["CUDA_HOME"],
20
+ "" if "LD_LIBRARY_PATH" not in os.environ else os.environ["LD_LIBRARY_PATH"],
21
+ )
22
+ # Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
23
+ os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
24
+
25
+ install_cuda_toolkit()
26
+
27
+ ###################################################
28
+
29
 
30
  from argparse import Namespace
31
  import pprint