Spaces:
Running on Zero
Running on Zero
Upload app_deepseek.py
Browse files- app_deepseek.py +38 -9
app_deepseek.py
CHANGED
|
@@ -293,6 +293,23 @@ changes where the tokenizer/template are read from). Kept/strengthened as the re
|
|
| 293 |
its 1M context lets a scenario be grounded in a FULL paper or advisory instead of a MAX_PROMPT_CHARS-
|
| 294 |
truncated excerpt. See WHAT CHANGED IN v8 for the real enable_thinking=False switch and native DSML
|
| 295 |
tool-call fallback this chat_template.jinja also made possible.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 296 |
FOUR sibling files (glm/minimax/deepseek/kimi/qwen minus this one) run the same pipeline, each specialized
|
| 297 |
differently -- see WHAT CHANGED IN v7 and WHAT CHANGED IN v8 at the top of this file for the full table and the
|
| 298 |
evidence behind each choice. all five write into the SAME dataset concurrently -- see MODEL_TAG and the v6 note above for how that stays race-free. The chat template + tokenizer come from the
|
|
@@ -1553,15 +1570,27 @@ def download_llama_cpu_release():
|
|
| 1553 |
arch = "arm64" if platform.machine().lower() in ("aarch64", "arm64") else "x64"
|
| 1554 |
base = "https://github.com/ggml-org/llama.cpp/releases"
|
| 1555 |
hdr = {"User-Agent": _CRAWLER_UA}
|
| 1556 |
-
|
| 1557 |
-
|
| 1558 |
-
|
| 1559 |
-
|
| 1560 |
-
|
| 1561 |
-
|
| 1562 |
-
|
| 1563 |
-
|
| 1564 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1565 |
last_err = "no candidate tag"
|
| 1566 |
for tag in tags:
|
| 1567 |
dest = os.path.join(LLAMA_CPU_DIR, tag)
|
|
|
|
| 293 |
its 1M context lets a scenario be grounded in a FULL paper or advisory instead of a MAX_PROMPT_CHARS-
|
| 294 |
truncated excerpt. See WHAT CHANGED IN v8 for the real enable_thinking=False switch and native DSML
|
| 295 |
tool-call fallback this chat_template.jinja also made possible.
|
| 296 |
+
v8.1 (field report, CPU-only): llama-server itself (not this file) crashed on startup --
|
| 297 |
+
GGML_ASSERT(*cur_backend_id != -1) failed in ggml_backend_sched_split_graph, during context/graph
|
| 298 |
+
reserve, before any chat() call -- with -ngl 0 on this exact GGUF. DeepSeek-V4 support in llama.cpp was
|
| 299 |
+
still WIP/fork-based as of its own GitHub support thread (multiple different per-backend crashes already
|
| 300 |
+
reported there, none of them this exact one) -- the signature (no backend can run some op in the graph)
|
| 301 |
+
matches "this architecture's CPU backend coverage is still incomplete", not a bug in this script,
|
| 302 |
+
confirmed by the earlier pipeline stages (model/tokenizer/chat_template.jinja all downloaded and loaded
|
| 303 |
+
fine; the crash is inside the llama-server binary itself). Two things to try, cheapest first: (1) a
|
| 304 |
+
PLAIN quant instead of an Unsloth Dynamic one -- GIJL_GGUF_QUANT=Q2_K (85.7GB) or Q3_K_S (101GB) --
|
| 305 |
+
since UD- quants mix per-layer precision/tensor types a brand-new architecture's CPU graph-splitter may
|
| 306 |
+
not handle as uniformly; (2) GIJL_LLAMA_CPU_TAG=<tag> (new in v8.1, see download_llama_cpu_release()) to
|
| 307 |
+
pin a specific llama.cpp release instead of always "latest", to confirm whether this is build-specific.
|
| 308 |
+
If neither works, this is upstream, not local: either wait for llama.cpp's CPU backend for this
|
| 309 |
+
architecture to mature (GIJL_LLAMA_SERVER is unset by default, so a later run automatically tries
|
| 310 |
+
whatever "latest" is by then -- no file change needed), or point GIJL_LLAMA_SERVER (already supported,
|
| 311 |
+
see ensure_llama_server()) at a self-built binary from an experimental third-party CPU-capable fork --
|
| 312 |
+
unofficial, so verify it yourself before trusting it with real data.
|
| 313 |
FOUR sibling files (glm/minimax/deepseek/kimi/qwen minus this one) run the same pipeline, each specialized
|
| 314 |
differently -- see WHAT CHANGED IN v7 and WHAT CHANGED IN v8 at the top of this file for the full table and the
|
| 315 |
evidence behind each choice. all five write into the SAME dataset concurrently -- see MODEL_TAG and the v6 note above for how that stays race-free. The chat template + tokenizer come from the
|
|
|
|
| 1570 |
arch = "arm64" if platform.machine().lower() in ("aarch64", "arm64") else "x64"
|
| 1571 |
base = "https://github.com/ggml-org/llama.cpp/releases"
|
| 1572 |
hdr = {"User-Agent": _CRAWLER_UA}
|
| 1573 |
+
pinned_tag = os.environ.get("GIJL_LLAMA_CPU_TAG", "").strip()
|
| 1574 |
+
if pinned_tag:
|
| 1575 |
+
# v8: bisecting knob, opt-in only (default behavior below is unchanged) -- added because DeepSeek-V4-Flash
|
| 1576 |
+
# crashed llama-server on CPU with GGML_ASSERT(*cur_backend_id != -1) in ggml_backend_sched_split_graph
|
| 1577 |
+
# during context/graph setup, a signature consistent with "this architecture's CPU backend coverage in
|
| 1578 |
+
# llama.cpp is still incomplete" rather than anything wrong in this file -- DeepSeek-V4 support was still
|
| 1579 |
+
# WIP/fork-based in llama.cpp as of its own GitHub support thread. "latest" always means whatever today's
|
| 1580 |
+
# CI build is, so there is no way to test a different one without this. EXCLUSIVE on purpose (no silent
|
| 1581 |
+
# fallback to latest): the point is to know for certain which build actually ran.
|
| 1582 |
+
print(f"[llama] GIJL_LLAMA_CPU_TAG={pinned_tag} set -- using this exact release instead of latest", flush=True)
|
| 1583 |
+
tags = [pinned_tag]
|
| 1584 |
+
else:
|
| 1585 |
+
tags = []
|
| 1586 |
+
try:
|
| 1587 |
+
latest = requests.get(f"{base}/latest", timeout=30, headers=hdr).url.rstrip("/").rsplit("/", 1)[-1]
|
| 1588 |
+
nt = requests.get(f"{base}/download/{latest}/nightly-tag.txt", timeout=30, headers=hdr)
|
| 1589 |
+
if nt.status_code == 200 and nt.text.strip():
|
| 1590 |
+
tags.append(nt.text.strip().split()[0])
|
| 1591 |
+
tags.append(latest)
|
| 1592 |
+
except requests.RequestException as e:
|
| 1593 |
+
raise RuntimeError(f"cannot reach GitHub releases: {_redact(str(e))[:200]}")
|
| 1594 |
last_err = "no candidate tag"
|
| 1595 |
for tag in tags:
|
| 1596 |
dest = os.path.join(LLAMA_CPU_DIR, tag)
|