Spaces:
Running on Zero
Running on Zero
Fix: detect stale cache, re-extract if libs missing
Browse files
app.py
CHANGED
|
@@ -430,9 +430,16 @@ def _ensure_llama_cpp():
|
|
| 430 |
os.makedirs(bin_dir, exist_ok=True)
|
| 431 |
|
| 432 |
llama_cli = os.path.join(bin_dir, "llama-cli")
|
| 433 |
-
|
|
|
|
| 434 |
_LLAMA_CPP_BIN = llama_cli
|
| 435 |
return llama_cli
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 436 |
|
| 437 |
_log("Benchmark: downloading llama.cpp binary...")
|
| 438 |
# Use a known stable release
|
|
|
|
| 430 |
os.makedirs(bin_dir, exist_ok=True)
|
| 431 |
|
| 432 |
llama_cli = os.path.join(bin_dir, "llama-cli")
|
| 433 |
+
lib_llama = os.path.join(bin_dir, "libllama.so")
|
| 434 |
+
if os.path.isfile(llama_cli) and os.path.isfile(lib_llama):
|
| 435 |
_LLAMA_CPP_BIN = llama_cli
|
| 436 |
return llama_cli
|
| 437 |
+
# Stale cache: remove old files and re-extract
|
| 438 |
+
if os.path.isfile(llama_cli):
|
| 439 |
+
_log("Benchmark: stale llama.cpp cache (missing libs), re-downloading...")
|
| 440 |
+
import shutil as _shutil
|
| 441 |
+
_shutil.rmtree(bin_dir, ignore_errors=True)
|
| 442 |
+
os.makedirs(bin_dir, exist_ok=True)
|
| 443 |
|
| 444 |
_log("Benchmark: downloading llama.cpp binary...")
|
| 445 |
# Use a known stable release
|