Spaces:
Running
Running
Commit
·
1323203
1
Parent(s):
d709b4a
install cuda toolkit
Browse files
app.py
CHANGED
@@ -9,6 +9,25 @@ import torch
|
|
9 |
import json
|
10 |
import bs4
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
product_strings = []
|
13 |
with open('./Data/products.json', 'r', encoding='utf-8') as f:
|
14 |
for product in json.load(f)['products']:
|
@@ -232,7 +251,6 @@ def respond(
|
|
232 |
print(f"Frage Nutzer: {query}\n Antwort Assistent: {answer}")
|
233 |
return answer
|
234 |
|
235 |
-
|
236 |
"""
|
237 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
238 |
"""
|
|
|
9 |
import json
|
10 |
import bs4
|
11 |
|
12 |
+
def install_cuda_toolkit():
|
13 |
+
CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_550.54.14_linux.run"
|
14 |
+
# CUDA_TOOLKIT_URL = "https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda_12.2.0_535.54.03_linux.run"
|
15 |
+
CUDA_TOOLKIT_FILE = "/tmp/%s" % os.path.basename(CUDA_TOOLKIT_URL)
|
16 |
+
subprocess.call(["wget", "-q", CUDA_TOOLKIT_URL, "-O", CUDA_TOOLKIT_FILE])
|
17 |
+
subprocess.call(["chmod", "+x", CUDA_TOOLKIT_FILE])
|
18 |
+
subprocess.call([CUDA_TOOLKIT_FILE, "--silent", "--toolkit"])
|
19 |
+
|
20 |
+
os.environ["CUDA_HOME"] = "/usr/local/cuda"
|
21 |
+
os.environ["PATH"] = "%s/bin:%s" % (os.environ["CUDA_HOME"], os.environ["PATH"])
|
22 |
+
os.environ["LD_LIBRARY_PATH"] = "%s/lib:%s" % (
|
23 |
+
os.environ["CUDA_HOME"],
|
24 |
+
"" if "LD_LIBRARY_PATH" not in os.environ else os.environ["LD_LIBRARY_PATH"],
|
25 |
+
)
|
26 |
+
# Fix: arch_list[-1] += '+PTX'; IndexError: list index out of range
|
27 |
+
os.environ["TORCH_CUDA_ARCH_LIST"] = "8.0;8.6"
|
28 |
+
|
29 |
+
install_cuda_toolkkit()
|
30 |
+
|
31 |
product_strings = []
|
32 |
with open('./Data/products.json', 'r', encoding='utf-8') as f:
|
33 |
for product in json.load(f)['products']:
|
|
|
251 |
print(f"Frage Nutzer: {query}\n Antwort Assistent: {answer}")
|
252 |
return answer
|
253 |
|
|
|
254 |
"""
|
255 |
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
256 |
"""
|