Spaces:
Running on Zero
Running on Zero
Fix: try pre-built wheel first, fall back to source build
Browse files
app.py
CHANGED
|
@@ -426,10 +426,18 @@ def _run_benchmark():
|
|
| 426 |
except ImportError:
|
| 427 |
_log("Benchmark: installing llama-cpp-python...")
|
| 428 |
import subprocess
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 433 |
from llama_cpp import Llama
|
| 434 |
|
| 435 |
os.makedirs(_BENCHMARK_CACHE, exist_ok=True)
|
|
|
|
| 426 |
except ImportError:
|
| 427 |
_log("Benchmark: installing llama-cpp-python...")
|
| 428 |
import subprocess
|
| 429 |
+
# Try pre-built wheels first, fall back to source build
|
| 430 |
+
try:
|
| 431 |
+
subprocess.check_call(
|
| 432 |
+
[sys.executable, "-m", "pip", "install", "llama-cpp-python>=0.4.0", "--only-binary=:all:"],
|
| 433 |
+
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
|
| 434 |
+
)
|
| 435 |
+
except subprocess.CalledProcessError:
|
| 436 |
+
_log("Benchmark: no pre-built wheel, building from source...")
|
| 437 |
+
subprocess.check_call(
|
| 438 |
+
[sys.executable, "-m", "pip", "install", "llama-cpp-python>=0.4.0"],
|
| 439 |
+
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
|
| 440 |
+
)
|
| 441 |
from llama_cpp import Llama
|
| 442 |
|
| 443 |
os.makedirs(_BENCHMARK_CACHE, exist_ok=True)
|