You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge origin/main into feat/paged-cache; fold --paged-cache into --features
Update from main (brings in the cargo-style --features build option) and
fold the paged / block-table KV cache toggle into it:
- Add 'paged-cache' to _BUILD_FEATURES so 'mobius build --features paged-cache'
enables the paged KV cache, matching static-cache / fp8-kv-cache / text-only.
- Remove the standalone --paged-cache boolean flag (main dropped the other
boolean feature flags); --page-size / --num-pages remain as tuning params.
- Reword paged validation errors and docs (README, cli_reference, CHANGELOG)
to reference --features paged-cache.
- Add a cli_test covering --features paged-cache.
Conflicts resolved in __main__.py, tasks/_causal_lm.py (keep both paged params
and prune_lm_head), and CHANGELOG.md.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: justinchuby <justinchuby@users.noreply.github.com>
Build-mode toggles are collected under a single cargo-style `--features`
174
+
option. Pass a comma-separated list (and/or repeat the flag):
175
+
176
+
```
177
+
--features fp8-kv-cache,static-cache
178
+
--features prune-lm-head
179
+
--features text-only
173
180
```
174
-
--static-cache
181
+
182
+
Available features:
183
+
184
+
| Feature | Effect |
185
+
|---------|--------|
186
+
|`static-cache`| Pre-allocate fixed-size KV cache buffers using `TensorScatter` (pair with `--max-seq-len N`). Requires `DecoderLayer` / `MoEDecoderLayer` models. Cannot combine with `--task`. |
187
+
|`fp8-kv-cache`| Store the `GroupQueryAttention` KV cache as `FLOAT8E4M3FN` (per-tensor E4M3), halving KV-cache memory. Requires a GQA build (e.g. `--ep cuda --dtype f16`) and an ORT runtime with the FP8 KV-cache kernel (SM89+). Pair with `--kv-cache-scale-file` for calibrated scales. |
188
+
|`paged-cache`| Export a paged / block-table KV cache (vLLM PagedAttention / SGLang RadixAttention layout): a shared page pool plus `block_table` / `slot_mapping`, using only standard ONNX ops. Tune with `--page-size N` (default 16) and `--num-pages N` (dynamic when omitted). Requires `DecoderLayer` / `MoEDecoderLayer` models. Cannot combine with `--task` or the `static-cache` feature. |
189
+
|`prune-lm-head`| Select the final hidden-state position before the LM-head projection and emit logits shaped `[B, 1, vocab]`. Supported by models using the base `CausalLMModel.forward()` path; unsupported custom forwards fail explicitly. Use only when the downstream workflow does not need per-token logits. |
190
+
|`text-only`| Export the text backbone of a multimodal checkpoint as a standalone decoder-only LLM (see below). |
191
+
192
+
The legacy boolean flags `--static-cache`, `--fp8-kv-cache`, and
193
+
`--text-only` have been removed in favor of `--features`.
|`--max-shard-size SIZE`| Maximum shard size for safetensors external data (e.g. `5GB`). Only used with `--external-data safetensors`. |
207
243
|`--trust-remote-code`| Trust remote code when loading the HuggingFace model config. |
208
244
|`--component NAME`| Build only one component from a diffusers pipeline (e.g. `--component vae_decoder`). |
209
-
|`--text-only`|Export the text backbone of a multimodal checkpoint as a standalone decoder-only LLM. Strips vision/audio routing so the decoder uses `GroupQueryAttention` on GQA-capable EPs (build with `--ep cuda`/`dml`). Currently supported for `gemma4_unified` (`google/gemma-4-12B`). Not compatible with `--config` or `--component`. |
245
+
|`--kv-cache-scale-file PATH`|Optional JSON file of calibrated per-layer FP8 KV-cache scales (onnxruntime-genai format). Only used with the `fp8-kv-cache` feature; without it all layers use a unit scale of 1.0. |
210
246
211
247
#### Text-only example
212
248
213
249
```bash
214
250
# Export gemma-4-12B's text backbone as a GQA decoder-only LLM
215
-
mobius build --model google/gemma-4-12B output/ --text-only --ep cuda --dtype f16
0 commit comments