Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
6bad22e
1
Parent(s):
b897713
Downgraded package versions to hopefully work with Hugging Face spaces Zero GPU
Browse files- app.py +1 -0
- requirements.txt +6 -5
- tools/llm_funcs.py +2 -0
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
import pandas as pd
|
|
|
1 |
+
import spaces
|
2 |
import os
|
3 |
import gradio as gr
|
4 |
import pandas as pd
|
requirements.txt
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
pandas==2.2.3
|
2 |
gradio==5.34.2
|
3 |
-
|
|
|
4 |
boto3==1.38.38
|
5 |
pyarrow==19.0.1
|
6 |
openpyxl==3.1.3
|
@@ -12,9 +13,9 @@ google-genai==1.21.1
|
|
12 |
html5lib==1.1
|
13 |
beautifulsoup4==4.12.3
|
14 |
rapidfuzz==3.10.1
|
15 |
-
torch==2.
|
16 |
# CPU only: torch==2.7.1 --extra-index-url https://download.pytorch.org/whl/cpu
|
17 |
-
https://github.com/abetlen/llama-cpp-python/releases/download/v0.3.4-
|
18 |
# llama-cpp-python==0.3.9 - will work on Hugging Face spaces, but will not work for Zero GPU or GPU spaces, only CPU. Can then use Gemma 3.
|
19 |
# llama-cpp-python==0.3.9 -C cmake.args="-DGGML_CUDA=on" # CUDA version. Will not work on Hugging Face spaces as NVCC is not installed in their spaces
|
20 |
#llama-cpp-python==0.3.9 -C cmake.args="-DGGML_BLAS=ON;-DGGML_BLAS_VENDOR=OpenBLAS"# Linux compatibility - for recent models like Gemma 3 (Not Hugging Face)
|
@@ -22,7 +23,7 @@ https://github.com/abetlen/llama-cpp-python/releases/download/v0.3.4-cu124/llama
|
|
22 |
# llama-cpp-python==0.3.9 -C cmake.args="-DGGML_BLAS=ON;-DGGML_BLAS_VENDOR=OpenBLAS;-DBLAS_INCLUDE_DIRS=C:/<root-path-to-openblas>/OpenBLAS/include;-DBLAS_LIBRARIES=C:/<root-path-to-openblas>/OpenBLAS/lib/libopenblas.lib
|
23 |
#https://github.com/abetlen/llama-cpp-python/releases/download/v0.3.2/llama_cpp_python-0.3.2-cp311-cp311-win_amd64.whl # Use this for Windows if abov doesn't work, enough for Gemma 2b
|
24 |
#llama-cpp-python==0.3.2 --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu # Use this for guaranteed Linux compatibility - enough for Gemma 2b only
|
25 |
-
|
26 |
python-dotenv==1.1.0
|
27 |
-
|
28 |
typing_extensions==4.12.2
|
|
|
1 |
pandas==2.2.3
|
2 |
gradio==5.34.2
|
3 |
+
transformers==4.51.1
|
4 |
+
spaces==0.31.0 #0.37.0
|
5 |
boto3==1.38.38
|
6 |
pyarrow==19.0.1
|
7 |
openpyxl==3.1.3
|
|
|
13 |
html5lib==1.1
|
14 |
beautifulsoup4==4.12.3
|
15 |
rapidfuzz==3.10.1
|
16 |
+
torch==2.4.1 --extra-index-url https://download.pytorch.org/whl/cu121
|
17 |
# CPU only: torch==2.7.1 --extra-index-url https://download.pytorch.org/whl/cpu
|
18 |
+
https://github.com/abetlen/llama-cpp-python/releases/download/v0.3.4-cu121/llama_cpp_python-0.3.4-cp310-cp310-linux_x86_64.whl # Specify exact llama_cpp wheel for huggingface compatibility. Will not work with Gemma 3, only Gemma 2
|
19 |
# llama-cpp-python==0.3.9 - will work on Hugging Face spaces, but will not work for Zero GPU or GPU spaces, only CPU. Can then use Gemma 3.
|
20 |
# llama-cpp-python==0.3.9 -C cmake.args="-DGGML_CUDA=on" # CUDA version. Will not work on Hugging Face spaces as NVCC is not installed in their spaces
|
21 |
#llama-cpp-python==0.3.9 -C cmake.args="-DGGML_BLAS=ON;-DGGML_BLAS_VENDOR=OpenBLAS"# Linux compatibility - for recent models like Gemma 3 (Not Hugging Face)
|
|
|
23 |
# llama-cpp-python==0.3.9 -C cmake.args="-DGGML_BLAS=ON;-DGGML_BLAS_VENDOR=OpenBLAS;-DBLAS_INCLUDE_DIRS=C:/<root-path-to-openblas>/OpenBLAS/include;-DBLAS_LIBRARIES=C:/<root-path-to-openblas>/OpenBLAS/lib/libopenblas.lib
|
24 |
#https://github.com/abetlen/llama-cpp-python/releases/download/v0.3.2/llama_cpp_python-0.3.2-cp311-cp311-win_amd64.whl # Use this for Windows if abov doesn't work, enough for Gemma 2b
|
25 |
#llama-cpp-python==0.3.2 --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu # Use this for guaranteed Linux compatibility - enough for Gemma 2b only
|
26 |
+
|
27 |
python-dotenv==1.1.0
|
28 |
+
numpy==1.26.4
|
29 |
typing_extensions==4.12.2
|
tools/llm_funcs.py
CHANGED
@@ -30,6 +30,8 @@ print("Is a CUDA device available on this computer?", torch.backends.cudnn.enabl
|
|
30 |
if torch.cuda.is_available():
|
31 |
torch_device = "cuda"
|
32 |
gpu_layers = int(LLM_MAX_GPU_LAYERS)
|
|
|
|
|
33 |
try:
|
34 |
os.system("nvidia-smi")
|
35 |
except Exception as e:
|
|
|
30 |
if torch.cuda.is_available():
|
31 |
torch_device = "cuda"
|
32 |
gpu_layers = int(LLM_MAX_GPU_LAYERS)
|
33 |
+
print("CUDA version:", torch.version.cuda)
|
34 |
+
print("CUDA runtime version:", torch.cuda.runtime.version())
|
35 |
try:
|
36 |
os.system("nvidia-smi")
|
37 |
except Exception as e:
|