betterwithage commited on
Commit
04ffa5b
·
verified ·
1 Parent(s): b86866d

chore(sync): mirror backend .py + Dockerfile to Space (hf-sync-backend)

Browse files

Automated backend sync from szl-holdings/a11oy main via hf-sync-backend.
Updated (differed from the Space): Dockerfile
Deleted (gone from the repo + Dockerfile COPY set): (none)

Keeps the Space-built backend (serve.py + the Dockerfile-COPY'd .py
modules) identical to GitHub main so the Space never rebuilds from a
stale backend, new endpoints don't 404 there, and orphaned modules
removed from the repo don't linger in the Space tree.

Files changed (1) hide show
  1. Dockerfile +25 -19
Dockerfile CHANGED
@@ -449,25 +449,31 @@ COPY szl_alloy_models.py ./szl_alloy_models.py
449
  # no prebuilt wheel), but the GGUF weight below is now RELIABLY fetched (pinned
450
  # revision + retry + integrity verify) so the published image always carries it.
451
  # We never redistribute the weight in our repo — it is fetched from the HF repo.
452
- # OPTIONAL live CPU demo tier wheelPINNED PREBUILT (no source compile).
453
- # Previously `pip install "llama-cpp-python>=0.2.79"` built the wheel FROM SOURCE,
454
- # which fails to compile on CPU-only CI/hardware and was silently swallowed by the
455
- # trailing `|| echo`, so the alloy demo tier always degraded to the tower-side label.
456
- # python:3.12-slim is cp312 and the CI runner + box are linux_x86_64, and version
457
- # 0.3.19 publishes a matching cp312 linux_x86_64 prebuilt wheel on llama-cpp-python's
458
- # official CPU wheel index, so this resolves deterministically with NO from-source
459
- # build. The `|| echo` stays ONLY as a final safety net for a platform without a
460
- # matching prebuilt wheel (honest tower-side fallback, never fabricated output).
461
- # GUARD: because the `|| echo` keeps the image build GREEN even if this wheel
462
- # vanishes for cp312/linux_x86_64 (a silent demo-tier degrade), CI workflow
463
- # .github/workflows/llama-wheel-guard.yml re-runs this exact pinned install
464
- # (parsed from this line) on cp312/linux_x86_64 WITHOUT the mask and with
465
- # --only-binary, failing loudly if the prebuilt wheel is gone. When bumping the
466
- # version below, that guard verifies does not assume — the new wheel exists.
467
- RUN pip install --no-cache-dir \
468
- --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu \
469
- "llama-cpp-python==0.3.19" \
470
- || echo "[a11oy] llama-cpp-python prebuilt wheel unavailable on this platform -> alloy demo tier falls back to honest tower-side label"
 
 
 
 
 
 
471
  # GGUF weight — RELIABLY PRESENT (pinned revision + retry + integrity verify), NOT best-effort.
472
  # Previously a single best-effort `hf_hub_download(...) || echo` step: a transient download
473
  # failure silently shipped an image with NO model, so the alloy demo tier always degraded to
 
449
  # no prebuilt wheel), but the GGUF weight below is now RELIABLY fetched (pinned
450
  # revision + retry + integrity verify) so the published image always carries it.
451
  # We never redistribute the weight in our repo — it is fetched from the HF repo.
452
+ # CPU demo-tier llama.cppBUILT FROM SOURCE against glibc (NOT a prebuilt wheel).
453
+ # WHY: abetlen's CPU wheel index ships the recent, Qwen2.5-capable 0.3.x cp312
454
+ # linux_x86_64 wheels built against MUSL libc their bundled libllama.so NEEDs
455
+ # libc.musl-x86_64.so.1, which CANNOT load on this glibc python:3.12-slim base
456
+ # (dlopen fails: "libc.musl-x86_64.so.1: cannot open shared object file"), so the
457
+ # demo tier silently degrades to the honest tower-side label. The only glibc
458
+ # (manylinux) prebuilt cp312 wheels on that index are 0.2.6x far too old to load
459
+ # the Qwen2.5 GGUF architecture. So we compile llama-cpp-python==0.3.19 from source
460
+ # here: recent enough to load the Qwen2.5-Coder GGUF AND producing a glibc-linked
461
+ # libllama.so that actually loads. NO `|| echo` mask the demo tier is a HARD
462
+ # requirement of the published image (the ghcr-build-push "Demo tier serves REAL
463
+ # local model" step boots the image and fails the build if the alloy demo tier does
464
+ # not serve genuine local llama.cpp output), so a failed compile must fail LOUD.
465
+ # GUARD: .github/workflows/llama-wheel-guard.yml re-builds this exact pinned version
466
+ # from source on cp312/linux_x86_64 and asserts the resulting libllama.so links
467
+ # glibc (not musl) and imports — verifying, not assuming, the contract on each bump.
468
+ # GGML_NATIVE=OFF keeps the build portable (no -march=native) across CI + box CPUs.
469
+ RUN set -eux; \
470
+ apt-get update; \
471
+ apt-get install -y --no-install-recommends build-essential cmake ninja-build git libgomp1 libstdc++6; \
472
+ CMAKE_ARGS="-DGGML_NATIVE=OFF" pip install --no-cache-dir --no-binary llama-cpp-python "llama-cpp-python==0.3.19"; \
473
+ python3 -c "import llama_cpp, os, glob; base=os.path.dirname(llama_cpp.__file__); so=glob.glob(os.path.join(base,'**','libllama.so'), recursive=True); assert so, 'libllama.so not found under '+base; d=open(so[0],'rb').read(); assert b'libc.so.6' in d and b'libc.musl-x86_64.so.1' not in d, 'libllama.so is not glibc-linked: '+so[0]; print('[a11oy] llama_cpp built from source OK (glibc):', so[0], getattr(llama_cpp,'__version__','?'))"; \
474
+ apt-get purge -y build-essential cmake ninja-build git; \
475
+ apt-get autoremove -y; \
476
+ rm -rf /var/lib/apt/lists/*
477
  # GGUF weight — RELIABLY PRESENT (pinned revision + retry + integrity verify), NOT best-effort.
478
  # Previously a single best-effort `hf_hub_download(...) || echo` step: a transient download
479
  # failure silently shipped an image with NO model, so the alloy demo tier always degraded to