23v commited on
Commit
b905abf
·
verified ·
1 Parent(s): 86b9c88

Upload app_deepseek.py

Browse files
Files changed (1) hide show
  1. app_deepseek.py +20 -6
app_deepseek.py CHANGED
@@ -388,11 +388,17 @@ SEARCH_LANGUAGE_CYCLE = ["arabic", "english"]
388
  # "llamacpp" (default): llama-server + GGUF, on GPU (CUDA build) or CPU. llama.cpp cannot use TPU.
389
  # "hf": the old transformers path (only kept for reference; on TPU it produced ~3 chars/s and hung).
390
  BACKEND = os.environ.get("GIJL_BACKEND", "llamacpp").strip().lower()
391
- GGUF_REPO = os.environ.get("GIJL_GGUF_REPO", "unsloth/DeepSeek-V4-Flash-GGUF")
392
- GGUF_QUANT = os.environ.get("GIJL_GGUF_QUANT", "UD-Q2_K_XL") # highest quant unsloth ships; choose_quant() steps this down
393
- # automatically to whatever fits the detected VRAM/RAM
394
- # budget (see _memory_budget_gb) -- set GIJL_GGUF_QUANT
395
- # explicitly to pin a smaller quant instead.
 
 
 
 
 
 
396
  LLAMA_CTX = int(os.environ.get("GIJL_CTX", "12288")) # tokens; KV cache is ~2-4GB at this size
397
  LLAMA_LOAD_TIMEOUT_S = 1800
398
  LLAMA_BIN_DIR = os.path.join(WORK_DIR, "bin") # CUDA build cache (synced to the hub, see CACHE_LLAMA_BINARY)
@@ -1255,7 +1261,15 @@ def _group_gguf_files(siblings) -> dict:
1255
  for name, size in siblings:
1256
  base = os.path.basename(name)
1257
  low = base.lower()
1258
- if not low.endswith(".gguf") or any(x in low for x in ("mmproj", "dflash", "assistant", "draft")):
 
 
 
 
 
 
 
 
1259
  continue
1260
  m = _QUANT_RE.search(_SHARD_RE.sub("", base[:-5]))
1261
  if not m:
 
388
  # "llamacpp" (default): llama-server + GGUF, on GPU (CUDA build) or CPU. llama.cpp cannot use TPU.
389
  # "hf": the old transformers path (only kept for reference; on TPU it produced ~3 chars/s and hung).
390
  BACKEND = os.environ.get("GIJL_BACKEND", "llamacpp").strip().lower()
391
+ GGUF_REPO = os.environ.get("GIJL_GGUF_REPO", "unsloth/DeepSeek-V4-Flash-0731-GGUF")
392
+ # v6 bugfix: this repo ships no plain "Q8_0" quant directory -- only "UD-"-prefixed dynamic quants
393
+ # (UD-IQ1_M .. UD-Q8_K_XL) plus a top-level "dspark-DeepSeek-V4-Flash-0731-Q8_0.gguf" speculative-decoding
394
+ # DRAFT model whose filename happens to end in "-Q8_0". Before the _group_gguf_files() exclusion fix below,
395
+ # that draft file was mis-grouped as if it were the real "Q8_0" main-model quant and downloaded/loaded via
396
+ # -m, which llama-server then refused to initialize standalone ("dflash requires ctx_other to be set").
397
+ # Pinned to "UD-IQ3_XXS" (~104.2GB across its 4 shards, per the repo's own file listing) by request --
398
+ # the closest real quant this repo ships to a ~103-104GB file size. choose_quant() still steps it down
399
+ # automatically if it somehow doesn't fit the detected VRAM/RAM budget (see _memory_budget_gb); set
400
+ # GIJL_GGUF_QUANT to override explicitly.
401
+ GGUF_QUANT = os.environ.get("GIJL_GGUF_QUANT", "UD-IQ3_XXS")
402
  LLAMA_CTX = int(os.environ.get("GIJL_CTX", "12288")) # tokens; KV cache is ~2-4GB at this size
403
  LLAMA_LOAD_TIMEOUT_S = 1800
404
  LLAMA_BIN_DIR = os.path.join(WORK_DIR, "bin") # CUDA build cache (synced to the hub, see CACHE_LLAMA_BINARY)
 
1261
  for name, size in siblings:
1262
  base = os.path.basename(name)
1263
  low = base.lower()
1264
+ if not low.endswith(".gguf") or any(x in low for x in ("mmproj", "dflash", "dspark", "assistant", "draft")):
1265
+ # v6 bugfix: "dspark" added -- Unsloth ships DSpark speculative-decoding DRAFT models
1266
+ # (e.g. "dspark-DeepSeek-V4-Flash-0731-Q8_0.gguf") that are NOT standalone models; llama-server
1267
+ # refuses to load one via -m alone ("dflash requires ctx_other to be set") because it expects to be
1268
+ # paired with a real main-model quant via --model-draft. Without this exclusion, the quant-tag
1269
+ # regex below still matches e.g. "-Q8_0" at the end of the draft file's name and silently groups
1270
+ # it as if it were a legitimate "Q8_0" main-model quant, so it gets selected and downloaded instead
1271
+ # of the real model whenever a repo (like unsloth/DeepSeek-V4-Flash-0731-GGUF) has no quant
1272
+ # directory actually named "Q8_0" -- causing a hard crash at startup.
1273
  continue
1274
  m = _QUANT_RE.search(_SHARD_RE.sub("", base[:-5]))
1275
  if not m: