fomext commited on
Commit
2a30a1d
Β·
verified Β·
1 Parent(s): 6c216e1

Upload 2 files

Browse files
Files changed (2) hide show
  1. Dockerfile +3 -1
  2. app.py +7 -1
Dockerfile CHANGED
@@ -21,9 +21,11 @@ RUN pip install --no-cache-dir \
21
  pydantic==2.7.1
22
 
23
  # Install llama-cpp-python CPU-only (compiled from source)
 
 
24
  RUN CMAKE_ARGS="-DGGML_CUDA=OFF -DGGML_METAL=OFF -DGGML_OPENCL=OFF" \
25
  FORCE_CMAKE=1 \
26
- pip install --no-cache-dir llama-cpp-python==0.3.9
27
 
28
  # ── App code ─────────────────────────────────────────────────
29
  COPY app.py .
 
21
  pydantic==2.7.1
22
 
23
  # Install llama-cpp-python CPU-only (compiled from source)
24
+ # 0.3.4: new enough to read current GGUF format, stable enough to avoid
25
+ # the malloc/GGML_ASSERT corruption seen in 0.3.9 on CPU-only builds
26
  RUN CMAKE_ARGS="-DGGML_CUDA=OFF -DGGML_METAL=OFF -DGGML_OPENCL=OFF" \
27
  FORCE_CMAKE=1 \
28
+ pip install --no-cache-dir llama-cpp-python==0.3.4
29
 
30
  # ── App code ─────────────────────────────────────────────────
31
  COPY app.py .
app.py CHANGED
@@ -58,6 +58,13 @@ def _download_model() -> None:
58
  return
59
 
60
  path.parent.mkdir(parents=True, exist_ok=True)
 
 
 
 
 
 
 
61
  logger.info(f"Model not found β€” downloading from {MODEL_URL} ...")
62
  logger.info("This will take a while on first boot (file is ~9 GB).")
63
 
@@ -67,7 +74,6 @@ def _download_model() -> None:
67
  if not HF_TOKEN:
68
  logger.warning("HF_TOKEN not set β€” download may fail for gated models.")
69
 
70
- tmp = Path(str(MODEL_PATH) + ".part")
71
  req = urllib.request.Request(MODEL_URL, headers=headers)
72
 
73
  with urllib.request.urlopen(req) as response, open(tmp, "wb") as out:
 
58
  return
59
 
60
  path.parent.mkdir(parents=True, exist_ok=True)
61
+
62
+ # Clean up any stale partial download from a previous crashed attempt
63
+ tmp = Path(str(MODEL_PATH) + ".part")
64
+ if tmp.exists():
65
+ logger.warning(f"Removing stale partial download: {tmp}")
66
+ tmp.unlink()
67
+
68
  logger.info(f"Model not found β€” downloading from {MODEL_URL} ...")
69
  logger.info("This will take a while on first boot (file is ~9 GB).")
70
 
 
74
  if not HF_TOKEN:
75
  logger.warning("HF_TOKEN not set β€” download may fail for gated models.")
76
 
 
77
  req = urllib.request.Request(MODEL_URL, headers=headers)
78
 
79
  with urllib.request.urlopen(req) as response, open(tmp, "wb") as out: