Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
tags:
|
| 4 |
+
- executorch
|
| 5 |
+
- xnnpack
|
| 6 |
+
- pte
|
| 7 |
+
- on-device
|
| 8 |
+
- text-generation
|
| 9 |
+
base_model:
|
| 10 |
+
- Qwen/Qwen2.5-1.5B
|
| 11 |
+
---
|
| 12 |
+
# Qwen2.5-1.5B — ExecuTorch XNNPACK 8da4w + 8-bit embedding
|
| 13 |
+
|
| 14 |
+
`qwen2_5_1_5b_xnnpack_8da4w_e8.pte` (1035.3 MB)
|
| 15 |
+
|
| 16 |
+
- **Source**: Qwen/Qwen2.5-1.5B — the **base** model, not Instruct. It continues text; it
|
| 17 |
+
does not answer a chat template.
|
| 18 |
+
- **License**: Apache-2.0
|
| 19 |
+
- **Quantization**: 8da4w linear + 8-bit embedding (`embedding_quantize: "8,0"`)
|
| 20 |
+
- **Export**: executorch 1.4.0 `export_llm`, static shape (seq_len=1), max_seq_length 2048,
|
| 21 |
+
XNNPACK extended_ops
|
| 22 |
+
- **Config**: `llm_params/qwen2_5_1_5b_xnnpack_8da4w_e8.yaml`
|
| 23 |
+
|
| 24 |
+
## Verification (Mac arm64, 2026-08-21)
|
| 25 |
+
|
| 26 |
+
Completions, against the untouched model on the same prompts. A base model is checked this
|
| 27 |
+
way because a chat template gets it nowhere: fed one, it echoes the question back.
|
| 28 |
+
|
| 29 |
+
| prompt | this file | eager fp32 |
|
| 30 |
+
|---|---|---|
|
| 31 |
+
| "The capital of France is" | turns it into a multiple-choice question and answers A, Paris | " Paris. The capital of France is also the capital of the European Union…" |
|
| 32 |
+
| "Water boils at a temperature of" | "100°C and water freezes at a temperature of 0°C" | "212 °F or 100 °C and ice melts at a temperature of 32 °" |
|
| 33 |
+
| "Seventeen times four equals" | "what number? To determine what number 17 times 4 equals, we need to perform the multiplication" | "what number? To find the product of 17 and 4, we perform the multiplication: 17 *" |
|
| 34 |
+
|
| 35 |
+
The continuations differ, which they will once the weights are 4-bit, but nothing here is
|
| 36 |
+
wrong where eager is right. Decode **69.5 tok/s**, from one pass with nothing else running.
|
| 37 |
+
|
| 38 |
+
**The 0.5B of this pair is not on the shelf.** It fails that comparison rather than passing
|
| 39 |
+
it: asked where water boils it says 215 degrees Fahrenheit, where eager says 212 °F or
|
| 40 |
+
100 °C. Half a billion parameters do not survive 4-bit weights, and XNNPACK has no 8-bit
|
| 41 |
+
path that works — `torchao:8da8w` cannot be combined with the delegate and `qmode: int8`
|
| 42 |
+
falls over on grouped-query attention. At that size
|
| 43 |
+
[LFM2-350M](https://huggingface.co/mlboydaisuke/LFM2-350M-ExecuTorch) is smaller, faster and
|
| 44 |
+
correct.
|
| 45 |
+
|
| 46 |
+
## Converting it
|
| 47 |
+
|
| 48 |
+
```bash
|
| 49 |
+
python convert/export_from_safetensors.py qwen2_5_1_5b
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
Not `export_llm` directly: this repository ships safetensors only, and
|
| 53 |
+
`load_checkpoint_from_pytorch_model` reads `pytorch_model.bin`, so the code falls back to
|
| 54 |
+
torchtune's checkpointer. Qwen2.5's converter wants one thing from torchtune —
|
| 55 |
+
`get_mapped_key` — and ExecuTorch has its own copy of that function, so the script hands the
|
| 56 |
+
real one over and stubs the rest.
|
| 57 |
+
|
| 58 |
+
## Running it
|
| 59 |
+
|
| 60 |
+
```bash
|
| 61 |
+
python llm_params/gen_static.py \
|
| 62 |
+
--pte qwen2_5_1_5b_xnnpack_8da4w_e8.pte \
|
| 63 |
+
--tokenizer tokenizer.json \
|
| 64 |
+
--prompt 'The capital of France is' \
|
| 65 |
+
--eos_ids "[151643]"
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
The 8-bit embedding needs `from executorch.kernels import quantized` before the program is
|
| 69 |
+
loaded, and `portable_lib._load_for_executorch` rather than `executorch.runtime`.
|
| 70 |
+
|
| 71 |
+
(conversion scripts: [executorch-models](https://github.com/john-rocky/executorch-models) ·
|
| 72 |
+
iOS sample: [executorch-samples](https://github.com/john-rocky/executorch-samples))
|