howard-hou commited on
Commit
fa97487
1 Parent(s): cded6a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -1,6 +1,25 @@
1
  import os
2
  os.environ["RWKV_JIT_ON"] = '1'
3
  os.environ["RWKV_CUDA_ON"] = '1' # if '1' then use CUDA kernel for seq mode (much faster)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  # make sure cuda dir is in the same level as modeling_rwkv.py
5
  from modeling_rwkv import RWKV
6
 
 
1
  import os
2
  os.environ["RWKV_JIT_ON"] = '1'
3
  os.environ["RWKV_CUDA_ON"] = '1' # if '1' then use CUDA kernel for seq mode (much faster)
4
+
5
+ def install_cuda_toolkit():
6
+ CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run"
7
+ # CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
8
+ CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
9
+ subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
10
+ subprocess.call(["chmod", "+x", CUDA_TOOLKIT_FILE])
11
+ subprocess.call([CUDA_TOOLKIT_FILE, "--silent", "--toolkit"])
12
+
13
+ os.environ["CUDA_HOME"] = "/usr/local/cuda"
14
+ os.environ["PATH"] = "%s/bin:%s" % (os.environ["CUDA_HOME"], os.environ["PATH"])
15
+ os.environ["LD_LIBRARY_PATH"] = "%s/lib:%s" % (
16
+ os.environ["CUDA_HOME"],
17
+ "" if "LD_LIBRARY_PATH" not in os.environ else os.environ["LD_LIBRARY_PATH"],
18
+ )
19
+ # Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
20
+ os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
21
+
22
+ install_cuda_toolkit()
23
  # make sure cuda dir is in the same level as modeling_rwkv.py
24
  from modeling_rwkv import RWKV
25