From 1f6bdac759e02303e928b17fa09ffdc6fb90c73a Mon Sep 17 00:00:00 2001 From: Frank Date: Mon, 5 Oct 2026 18:58:57 -0700 Subject: [PATCH] frank-primary: add FreeToken PR587 ROCm serving image recipe Dockerfile builds the FreeToken engine (FlashML-org/FreeToken PR #587, pinned head 77a7201) inside the PR's own known-good ROCm 7.14 base image (torch 2.11/triton 3.7, gfx1201) on dankserver, rootless podman. Follows docs/install_amd.md exactly: --no-build-isolation --no-deps engine install, curated portable runtime deps, flashlib --no-deps, ninja for the QSA JIT; no flashinfer/sgl_kernel on ROCm (Triton fallback). --- .../docker/frank-primary-freetoken.Dockerfile | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 scripts/docker/frank-primary-freetoken.Dockerfile diff --git a/scripts/docker/frank-primary-freetoken.Dockerfile b/scripts/docker/frank-primary-freetoken.Dockerfile new file mode 100644 index 0000000..d10da93 --- /dev/null +++ b/scripts/docker/frank-primary-freetoken.Dockerfile @@ -0,0 +1,53 @@ +# frank-primary-freetoken.Dockerfile — FreeToken (PR #587 ROCm) serving image +# for the frank-primary endpoint (dankserver :7770, 1x R9700 gfx1201). +# +# Built on dankserver with rootless podman (dank user), same storage the +# service's `podman run` reads: +# podman build -t frank-primary-freetoken:pr587-77a7201 \ +# -f scripts/docker/frank-primary-freetoken.Dockerfile scripts/docker/ +# +# Base: the PR's own docs/install_amd.md names this exact image as the +# known-good ROCm 7.14 stack for gfx1201 (torch 2.11.0+rocm7.14, triton-rocm +# 3.7 — the original pin; FreeToken main+PR587 accepts torch>=2.11,<2.16 and +# triton>=3.6,<3.9). There is no rocm7.14+torch2.14 image on Docker Hub (the +# 2.14 images are rocm10.1.0 — an untested pair for this PR), so the PR doc's +# verbatim recommendation is the deployed stack. +# +# FreeToken source: FlashML-org/FreeToken PR #587 at pinned head +# 77a7201f98f00d93f618c6cf8b81ffe8360e0899 (branch rocm714_torch214, base +# main 581fdca3). The PR is ROCm-gated end to end; the NVIDIA/CUDA path is +# byte-identical to main. +# +# Build law from docs/install_amd.md: +# - `pip install --no-build-isolation --no-deps -e .` — the image's ROCm +# torch is preserved and used to compile the C++/HIP extensions. +# - NEVER a plain `pip install -e .` on ROCm: the dependency set is +# authored for NVIDIA (flashlib pulls numba + nvidia-cutlass-dsl; torch +# metadata pulls cuda-bindings) and the resolve can REPLACE the ROCm +# torch with a CUDA build. +# - Runtime deps installed explicitly, curated by the same doc. flashinfer +# / sgl_kernel / nvidia-cutlass-dsl have no ROCm builds and are +# intentionally absent — FreeToken gates them off and falls back to its +# Triton kernels on ROCm. +FROM rocm/pytorch:rocm7.14_ubuntu24.04_py3.12_pytorch_release_2.11.0 + +# Pin the PR head, not the branch: a future push to rocm714_torch214 would +# otherwise silently change the deployed engine. +RUN git clone https://github.com/FlashML-org/FreeToken.git /opt/FreeToken \ + && cd /opt/FreeToken \ + && git fetch origin pull/587/head \ + && git checkout 77a7201f98f00d93f618c6cf8b81ffe8360e0899 + +WORKDIR /opt/FreeToken +RUN python -m pip install --no-build-isolation --no-deps -e . + +# Curated runtime dependencies (docs/install_amd.md). transformers is pinned +# to the pyproject window (>=5.16,<5.17); the rest are the doc's portable set. +# torch / torchvision / triton-rocm come from the base image, 1:1 aligned. +RUN python -m pip install \ + "transformers>=5.16,<5.17" tokenizers safetensors huggingface_hub \ + fastapi uvicorn pydantic openai httpx anyio \ + einops gguf msgpack pyzmq typer rich apache-tvm-ffi \ + partial-json-parser \ + && python -m pip install --no-deps flashlib==0.3.0 \ + && python -m pip install ninja