Custom vLLM image for the Gemma 4 12B gemma4_unified gear (#71) (v0.33.0) - #76
Conversation
…vague /think) Idea->spec leg for issue #71. Converged frame + exported spec for a custom vLLM image (FROM nvcr.io/nvidia/vllm:26.05.post1-py3 + a pinned, uv-installed Transformers that registers gemma4_unified) so the vllm-multimodal gear loads, is live-validated co-resident on the Spark, and is promoted configured->load-tested. Confirmed decisions: only vllm-multimodal moves now (3 follow-up issues for the rest); local compose build: default + optional MULTIMODAL_IMAGE registry override; uv not pip; pinned transformers ref; validate+promote in one go (recipe merges regardless). Core risk recorded: no ref may both register gemma4_unified and keep vLLM 0.21.0 importing -> stays configured, await NGC release. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…vague /spec-to-plan) Spec->plan leg for issue #71. 6 tasks across 5 waves covering all 22 spec targets (c1-c12 + h1-h11): wave 0 (parallel, file-disjoint scaffold): t1 Dockerfile.vllm-gemma4, t2 compose+env wiring + MULTIMODAL_IMAGE override wave 1: t3 build+verify gemma4_unified registers w/o breaking vLLM 0.21.0 wave 2: t4 co-resident live serve + image/audio validation (zero disruption) wave 3: t5 gated smoke Layer B wave 4: t6 conditional promote configured->load-tested or park residual Risks r1-r6 parked (no working transformers ref; MTP method; util; context; fleet up --build vs override; 3 follow-up migration issues). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds a custom vLLM image Dockerfile so the Gemma 4 12B gemma4_unified multimodal gear can load. Bootstraps uv in the NGC 26.05.post1 base, installs Transformers via `uv pip install --system` (parameterised by TRANSFORMERS_REF; default is from-source HEAD, to be pinned in t3), and includes a network-free build-stage verification that asserts gemma4_unified is registered in CONFIG_MAPPING and a Gemma4 arch appears in vllm.ModelRegistry.get_supported_archs(). Static test added in tests/test_gemma4_dockerfile.py (8 assertions, no docker daemon, no network). Full suite: 810 passed, 6 skipped. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QUqLEWQVJjMRf3APCPcwiA
Wire vllm-multimodal to a custom Dockerfile (Dockerfile.vllm-gemma4) that
layers a gemma4_unified-capable Transformers build on the NGC 26.05 base.
Primary/embed/rerank keep image: nvcr.io/nvidia/vllm:26.04-py3 unchanged.
- docker-compose.yml: vllm-multimodal gains build: (context: .,
dockerfile: Dockerfile.vllm-gemma4) + image: ${MULTIMODAL_IMAGE:-lobes/vllm-gemma4:local};
commented interaction: lobes fleet up --build builds locally; with
MULTIMODAL_IMAGE set the operator pulls and skips the build.
- env.example: documents MULTIMODAL_IMAGE near the MULTIMODAL_* block
(unset = local build; set = ghcr.io/agentculture/... or local tag).
- Dockerfile.vllm-gemma4: stub template scaffolded by lobes init --fleet;
t1 fills in the pinned TRANSFORMERS_REF and verification step.
- lobes/runtime/_compose.py: Dockerfile.vllm-gemma4 added to FLEET_TEMPLATES
so the scaffolding guardrail (test_every_compose_referenced_dockerfile_is_scaffolded)
stays green.
- tests/test_gemma4_compose.py: new test asserting build/image structure on
vllm-multimodal, stock image on primary/embed/rerank, audio overlay untouched.
- tests/test_init.py: update fleet file-list assertion to include Dockerfile.vllm-gemma4.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QUqLEWQVJjMRf3APCPcwiA
# Conflicts: # lobes/templates/fleet/Dockerfile.vllm-gemma4
…71) t2's comments said the custom image layers on 26.04-py3; it is FROM 26.05.post1-py3 (the crux of #71 — 26.05 ships vLLM 0.21.x). Also corrected the registry-tag guidance: with build: + image: both set, --build rebuilds locally and shadows a pulled tag, so a registry tag needs plain docker compose (no --build), not 'lobes fleet up' which forces --build (risk r5). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Live build on the DGX Spark (spark-f8a9, GB10) surfaced two real failures the
static test missed, plus resolved the core risk r1:
1. Parse error: the multi-line RUN python3 -c "..." had no backslash
continuations, so Docker parsed each body line as an instruction
("unknown instruction: import"). Rewrote as one logical line; added a
Dockerfile-instruction lint to test_gemma4_dockerfile.py so the class is
caught statically (9 tests now).
2. PEP 668: uv refused --system on the base's externally-managed /usr Python.
Added --break-system-packages (the base sets PIP_BREAK_SYSTEM_PACKAGES for
pip only). Dropped the redundant pip-install-uv bootstrap (uv ships in 26.05).
r1 RESOLVED (positive): transformers main @ 181beb3 (5.13.0.dev0) both registers
gemma4_unified in AutoConfig AND keeps vLLM 0.21.0 importing/serving. Verified:
AutoConfig.from_pretrained(checkpoint) -> model_type gemma4_unified; ModelRegistry
shows Gemma4ForCausalLM/Gemma4ForConditionalGeneration/Gemma4MTPModel; vllm serve
--help exits 0 (with --gpus). Pinned TRANSFORMERS_REF to that SHA for reproducible
rebuilds (parked unknown v1 closed).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tion (#71) (v0.33.0) Live validation on the DGX Spark resolved the issue's core and corrected several unvalidated catalog assumptions. The custom image now LOADS gemma4_unified; the remaining serve-enablement is tracked as follow-ups (gear stays status=configured). What changed: - Dockerfile.vllm-gemma4 base 26.05.post1 -> 26.06 (vLLM 0.22.1, the serve-proven version; keeps NGC Blackwell torch 2.13.0a0). Transformers pinned to 181beb3 registers gemma4_unified. - catalog: gemma quantization modelopt_fp4 -> compressed-tensors (the checkpoint's actual quant_method; modelopt_fp4 fails with a method mismatch). Removed the gemma4_mtp speculative_config (vLLM enables Gemma4 MTP only via a separate gemma4_assistant draft model the checkpoint doesn't expose). - compose/env: MULTIMODAL_QUANTIZATION default compressed-tensors; drop the --speculative-config flag; add VLLM_ATTENTION_BACKEND=TRITON_ATTN (Gemma4's non-square attention: global_head_dim 512 != head_dim 256). - docs/gemma-4-12b-nvfp4.md: full live-validation writeup (runtime matrix, the o_proj 4096!=8192 root cause, 128K context confirmed, serve-enablement follow-up). - tests updated to the corrected reality (quant, no spec-config, TRITON_ATTN env, 26.06 base); added a fleet test asserting the Triton backend. Open follow-ups (separate issues): force TRITON_ATTN on vLLM's transformers-modeling backend; validate/switch to the blog-proven coolthor checkpoint; source a gemma4_assistant MTP draft. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PR Summary by QodoAdd custom vLLM image + fleet wiring for Gemma4
AI Description
Diagram
High-Level Assessment
Files changed (20)
|
Code Review by Qodo
Context used✅ Tickets:
🎫 Custom vLLM image for the Gemma 4 12B multimodal gear (gemma4_unified) — start with nightly Transformers 🎫 Gemma4 native MTP: source/build a gemma4_assistant draft model for speculative decoding 🎫 Validate coolthor/gemma-4-12B-it-NVFP4A16 (blog-proven) and consider it as the multimodal default✅ Compliance rules (platform):
18 rules✅ Skills:
doc-test-alignment, cicd 1. vllm-multimodal not on registry tag
|
- docs/gemma-4-12b-nvfp4.md:62 — underscore emphasis → asterisk (CI lint MD049/emphasis-style failure). - docker-compose.yml:381 — vllm-multimodal comment still said FROM 26.05.post1; corrected to 26.06 to match the Dockerfile (Qodo requirement-gap #1 sub-point: doc/comment drift vs the shipped base image). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Triage of Qodo's 4 requirement gapsThanks Qodo. 0 bugs / 0 rule violations; the 4 "requirement gaps" are compliance rules minted from #71's literal acceptance text. One sub-point was a genuine doc-drift bug (fixed); the rest are deliberate, spec-converged decisions or work explicitly split into follow-ups. Also fixed the CI lint failure (markdownlint MD049 in Gap 1 — base
Gap 2 — not on a registry tag → pushback (deliberate design). Local compose Gap 3 — serve not validated & Gap 4 — not promoted — lobes (Claude) |
|



Resolves the core of #71 and corrects the multimodal gear's config from live validation on the DGX Spark (
spark-f8a9, GB10). Specced/planned via/think→/spec-to-plan; wave-0 scaffold fanned out via/assign-to-workforce; live waves run on the Spark.What #71 asked, and what's delivered
#71 asked for a custom vLLM image whose Transformers registers
gemma4_unifiedso the multimodal gear can load. Done and verified live:Dockerfile.vllm-gemma4—FROM nvcr.io/nvidia/vllm:26.06-py3(vLLM 0.22.1, the serve-proven version; keeps NGC's Blackwell torch 2.13.0a0) + auv-installed, pinned from-source Transformers (181beb3, 5.13.0.dev0). Build-time, network-free verify assertsgemma4_unified ∈ CONFIG_MAPPING,import vllm, and aGemma4arch inModelRegistry. Confirmed:AutoConfig.from_pretrained(checkpoint)→model_type: gemma4_unified; weights load.vllm-multimodalbuilds the image (build:) with aMULTIMODAL_IMAGEoverride (local build by default; optionalghcr.io/local-registry tag). primary/embed/rerank stay on26.04.Corrections from live validation
modelopt_fp4→compressed-tensors(the checkpoint's actualquant_method;modelopt_fp4fails with a method mismatch).gemma4_mtp--speculative-config— vLLM 0.21/0.22 enable Gemma4 MTP only via a separategemma4_assistantdraft the checkpoint doesn't expose (gemma4_mtpis rejected).VLLM_ATTENTION_BACKEND=TRITON_ATTNadded — Gemma 4's non-square attention (global_head_dim 512 ≠ head_dim 256) needs it.text_config.max_position_embeddings=131072).Status: still
configured(serve-enablement deferred)The gear loads but does not yet serve: it crashes at warmup with
Shape mismatch: a.size(1)=4096, size_k=8192(o_proj) because vLLM runsgemma4_unifiedvia its transformers-modeling backend, which didn't honorTRITON_ATTNin our runs. This is well-characterized and split into follow-ups:coolthor/gemma-4-12B-it-NVFP4A16; maybe switch the defaultgemma4_assistantdraft for native MTPdocs/gemma-4-12b-nvfp4.mdcarries the full writeup (runtime matrix, root cause, resolved-vs-open).Tests / version
825 passed, 6 skipped; lint (black/isort/flake8) clean; rubric gate (afi cli doctor --strict) passes.TRITON_ATTN, 26.06 base) + a new fleet assertion for the Triton backend.— lobes (Claude)
🤖 Generated with Claude Code