Desktop foundation / core (ubuntu-latest) (push) Failing after 28s
Desktop foundation / core (macos-latest) (push) Canceled after 0s
Desktop foundation / core (windows-latest) (push) Canceled after 0s
Linux / verify (push) Canceled after 0s
Linux / keyless-cuda (push) Canceled after 0s
Linux / static-cuda-package (push) Canceled after 0s
Linux / hosted-cuda-package (push) Canceled after 0s
Linux / linux-static-cli (push) Canceled after 0s
Linux / linux-cli-container (push) Canceled after 0s
Linux / release-cli (push) Canceled after 0s
16 lines
2.6 KiB
Markdown
16 lines
2.6 KiB
Markdown
# Native model preparation contract
|
|
|
|
The reference implementation is the imported upstream Strata at the commit in `docs/upstream.md`. This inventory records what the native `model prepare` command must reproduce before the Python tooling can be removed from the install path.
|
|
|
|
| Upstream source | Inputs | Outputs and required behavior |
|
|
| --- | --- | --- |
|
|
| `tools/iq_pack.py` | First GGUF shard, all adjacent split shards, optional base pack | `index.txt` v3, aligned `dense.bin`, `conversions.json`, `native_experts.txt` v3/v4 completion marker, tokenizer files; optional `extra.bin`, `experts.bin` and provenance sidecar |
|
|
| `tools/pack_index.py` | Pack `manifest.json` from the older pack path | `index.txt` v3 with file ID, type/kind, source/destination offsets, shapes and quantization plane attributes |
|
|
| `tools/strata_tokenizer.py` | GGUF tokenizer metadata | `tokenizer/vocab.json`, `merges.txt`, `token_type.json`, `tokenizer.json`, and `chat_template.jinja` |
|
|
|
|
`iq_pack.py` serves quantized non-expert tensors from the original GGUF, writes small float tensors to `dense.bin`, and records exact or rounded conversions. Its `native_experts.txt` has absolute offsets for gate/up/down in each shard and is published last as the pack completion marker. An optional `experts.bin` is reused only after its source sidecar and sampled blobs match the current model. The 28.8 GB per-layer token embedding table remains in the GGUF. The initial IQ3_S path should preserve native quantized bytes; no lossy conversion is enabled by default.
|
|
|
|
`strata_tokenizer.py` is the behavioral oracle for Qwen byte-level BPE, special tokens, the `qwen35` pre-tokenizer pattern, and chat template. Native extraction alone is insufficient; encoding and decoding must be checked on multilingual text, emoji, combining marks, whitespace, control bytes, and tool-call prompts.
|
|
|
|
The Rust CLI now has bounded `model inspect`, `model extract-tokenizer`, and native BPE encode/decode commands. Extraction checks the tokenizer metadata and produces the five upstream asset files without Python. A synthetic GGUF was compared against the pinned upstream extractor; all five files matched as parsed JSON or exact text. Native BPE matched upstream on 40 synthetic full-byte vocabulary cases, covering multilingual text, emoji, combining marks, control bytes, long words, and control/user-defined literals. These checks do not validate the real IQ3_S tokenizer. The next step is to compare header metadata with upstream `strata-gguf` on representative fixtures and both real IQ3_S shards, then implement the pack formats and differential byte checks. No model bytes are committed to Git.
|