prune: remove superseded/non-functional artifacts
Browse files- README.md +39 -99
- gpu-pipelined/lfm2_5_8b_a1b_decode_sym8_gather/lfm2_5_8b_a1b_decode_sym8_gather.aimodel/main.hash +0 -1
- gpu-pipelined/lfm2_5_8b_a1b_decode_sym8_gather/lfm2_5_8b_a1b_decode_sym8_gather.aimodel/main.mlirb +0 -3
- gpu-pipelined/lfm2_5_8b_a1b_decode_sym8_gather/lfm2_5_8b_a1b_decode_sym8_gather.aimodel/metadata.json +0 -5
- gpu-pipelined/lfm2_5_8b_a1b_decode_sym8_gather/metadata.json +0 -28
- gpu-pipelined/lfm2_5_8b_a1b_decode_sym8_gather/tokenizer/chat_template.jinja +0 -115
- gpu-pipelined/lfm2_5_8b_a1b_decode_sym8_gather/tokenizer/tokenizer.json +0 -3
- gpu-pipelined/lfm2_5_8b_a1b_decode_sym8_gather/tokenizer/tokenizer_config.json +0 -11
README.md
CHANGED
|
@@ -18,10 +18,10 @@ tags:
|
|
| 18 |
|
| 19 |
# LFM2.5-8B-A1B — Core AI (.aimodel)
|
| 20 |
|
| 21 |
-
`LiquidAI/LFM2.5-8B-A1B` as Core AI `.aimodel`
|
| 22 |
-
[visible-cx](https://huggingface.co/visible-cx). `
|
| 23 |
-
|
| 24 |
-
|
| 25 |
|
| 26 |
It is a **sparse mixture-of-experts** model: 8.3B total parameters, ~1.5B active per token.
|
| 27 |
24 layers — 18 short-convolution mixers and 6 GQA attention layers; the first two layers are
|
|
@@ -35,70 +35,42 @@ weights read as a dense over-read.
|
|
| 35 |
| | |
|
| 36 |
|---|---|
|
| 37 |
| Base checkpoint | `LiquidAI/LFM2.5-8B-A1B` |
|
| 38 |
-
| Upstream bundle (`gpu-pipelined/`) | `mlboydaisuke/LFM2.5-8B-A1B-CoreAI` @ `1e494ef6dd5c499e18d5c1730ddf4bda76b9e039` |
|
| 39 |
| Zoo recipe | `models/lfm2.5-8b-a1b-moe/recipe.toml` → `["lfm2.5-8b-a1b"]`, `status = "verified"` |
|
| 40 |
-
| Recipe
|
| 41 |
| Producer fingerprint | `coreai-core 1.0.0b2` on every inner asset `metadata.json` |
|
| 42 |
-
| Asset creation
|
| 43 |
| Weight format | **`sym8`** — symmetric-linear **int8**, per-K-block-32 scale, read through the `gather_qmm` Metal kernel |
|
| 44 |
| Vocab | 128,000 |
|
| 45 |
-
| Export functions | `
|
| 46 |
|
| 47 |
`sym8`, not int4. An `int4km-gather` variant exists upstream and is deliberately not
|
| 48 |
published: non-QAT int4 does not hold quality on this model (+12 output flips out of 41
|
| 49 |
against the fp16 reference), where `sym8` is clean (+1 flip out of 41, the fp16 ceiling).
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
entrypoints keep the gather kernel.
|
| 55 |
|
| 56 |
## Contents
|
| 57 |
|
| 58 |
| Path | Bytes | Files | Manifest context | Functions |
|
| 59 |
|---|---:|---|---|---|
|
| 60 |
-
| `gpu-pipelined/lfm2_5_8b_a1b_decode_sym8_gather` | 9,447,532,211 | 7 | 8192 | main (decode only) |
|
| 61 |
| `mf64/lfm2_5_8b_a1b_decode_sym8_gather_mf64` | 9,447,767,758 | 7 | 16384 | main + prefill |
|
| 62 |
|
| 63 |
-
|
| 64 |
`metadata.json`), a bundle-level `metadata.json`, and `tokenizer/` (`tokenizer.json`,
|
| 65 |
`tokenizer_config.json`, `chat_template.jinja`).
|
| 66 |
|
| 67 |
-
**Stop token:** `eos_token = "<|im_end|>"`
|
| 68 |
|
| 69 |
-
##
|
| 70 |
|
| 71 |
-
|
| 72 |
-
`
|
| 73 |
-
|
| 74 |
-
**
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
does:
|
| 78 |
-
|
| 79 |
-
| prompt | prompt tokens | TTFT | decode | TTFT share of wall |
|
| 80 |
-
|---|---|---|---|---|
|
| 81 |
-
| guided sample | 765 | 17.1 s | 45.9 tok/s | 93 % |
|
| 82 |
-
| free-form 3.4k | 3,249 | 70.1 s | 47.0 tok/s | 79 % |
|
| 83 |
-
| free-form 8k | 7,673 | 165.1 s | 45.2 tok/s | 93 % |
|
| 84 |
-
|
| 85 |
-
`mf64/`'s S=64 prefill entrypoint reduces this to **6.3 ms per prompt token**, a **3.4×**
|
| 86 |
-
speed-up, measured below.
|
| 87 |
-
|
| 88 |
-
**2. The chat template does not terminate the reasoning block.** `gpu-pipelined/`'s
|
| 89 |
-
`chat_template.jinja` emits `{{- "<|im_start|>assistant\n" -}}` with no `<think></think>`.
|
| 90 |
-
LFM2.5-8B-A1B is an always-thinking model, so free-form generation spends the whole budget
|
| 91 |
-
inside an unterminated `<think>` block: a 900-token generation produced **0 characters** of
|
| 92 |
-
response. Guided decoding is unaffected, because the grammar forces structured output from
|
| 93 |
-
the first token. Terminating the block —
|
| 94 |
-
`{{- "<|im_start|>assistant\n<think></think>\n" -}}`, the same form the LFM2.5-2.6B bundles
|
| 95 |
-
use — turns that run into a 4,838-character answer.
|
| 96 |
-
|
| 97 |
-
`mf64/` fixes both: it adds a static S=64 chunked-prefill entrypoint sharing one copy of
|
| 98 |
-
the `sym8` weights, and it emits the terminated think block in the generation prompt. Both
|
| 99 |
-
fixes are confirmed by measurement: free-form generation returns **4,561 characters** with
|
| 100 |
-
the bundle exactly as published, and prompt-token counts are uniformly **+3** against
|
| 101 |
-
`gpu-pipelined/` on identical inputs — the `<think></think>` tokens.
|
| 102 |
|
| 103 |
## Requirements
|
| 104 |
|
|
@@ -106,7 +78,7 @@ the bundle exactly as published, and prompt-token counts are uniformly **+3** ag
|
|
| 106 |
an iPhone even with the memory-limit entitlement.
|
| 107 |
- **Engine contract: 2 inputs** (`input_ids`, `position_ids`) → logits. No static inputs,
|
| 108 |
no per-step mask.
|
| 109 |
-
- **Memory, measured:** max RSS **9.0–
|
| 110 |
footprint 0.16–0.39 GB. **Minimum practical machine memory: 16 GB**, with little else
|
| 111 |
resident — the model runs on that tier but leaves almost no headroom. 24 GB or more is
|
| 112 |
the comfortable tier.
|
|
@@ -121,21 +93,19 @@ Measured on a **16 GB Apple silicon Mac (M2 Pro, macOS 27 beta)**, sequential en
|
|
| 121 |
`reset()` between samples. Load excluded from `s/row`; sample 1 excluded as a cache-warm
|
| 122 |
outlier.
|
| 123 |
|
| 124 |
-
|
| 125 |
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
|
| 129 |
-
|-
|
| 130 |
-
|
|
| 131 |
-
|
|
| 132 |
-
|
|
| 133 |
-
|
|
| 134 |
-
|
|
| 135 |
-
|
|
| 136 |
-
|
|
| 137 |
-
| Peak footprint | 0.16 GB | 0.39 GB |
|
| 138 |
-
| Max RSS | 10.61 GB | 9.04 GB |
|
| 139 |
|
| 140 |
Unguided, 900-token cap:
|
| 141 |
|
|
@@ -144,54 +114,24 @@ Unguided, 900-token cap:
|
|
| 144 |
| 3.4k | 3,249 | **22.34 s** | 50.97 tok/s | 821 | **38.4 s** | 4,561 | 10.73 GB |
|
| 145 |
| 8k | 7,673 | **48.07 s** | 47.67 tok/s | 900 | **66.8 s** | 5,084 | 10.55 GB |
|
| 146 |
|
| 147 |
-
**Needle-in-haystack: 3/3 at 8k and 3/3 at 15k.**
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
in depth.
|
| 153 |
|
| 154 |
**Cold-load caveat.** The first load of a freshly downloaded copy was **60.6 s**, since it
|
| 155 |
includes the graph compile. Subsequent loads were **22.9–26.2 s**. Budget roughly 17 GB of
|
| 156 |
on-disk compile cache in addition to the 9.4 GB bundle.
|
| 157 |
|
| 158 |
-
### `gpu-pipelined/` — superseded
|
| 159 |
-
|
| 160 |
-
| | |
|
| 161 |
-
|---|---|
|
| 162 |
-
| Cold load | 21.3 s |
|
| 163 |
-
| Guided JSON parse | **10/10** |
|
| 164 |
-
| Enum-clean | **10/10** |
|
| 165 |
-
| s/row (long samples) | **17.88** |
|
| 166 |
-
| s/row (short samples) | **8.59** |
|
| 167 |
-
| Decode | **45.2–46.6 tok/s** |
|
| 168 |
-
| TTFT | **6.5–23.3 s** |
|
| 169 |
-
| Peak footprint | 0.16 GB |
|
| 170 |
-
| Max RSS | 10.61 GB |
|
| 171 |
-
|
| 172 |
Decode is healthy for the size — an MoE with ~1B active parameters decoding faster than a
|
| 173 |
-
dense 2.6B.
|
| 174 |
-
10× the LFM2.5-1.2B, entirely because of the missing prefill function.
|
| 175 |
-
|
| 176 |
-
Unguided, free-form generation from a fixed prompt, 900-token cap, with the chat template
|
| 177 |
-
patched to terminate the think block (unpatched, these runs return 0 characters).
|
| 178 |
-
|
| 179 |
-
| depth | prompt tokens | TTFT | decode | generated | wall | peak footprint | max RSS |
|
| 180 |
-
|---|---|---|---|---|---|---|---|
|
| 181 |
-
| 3.4k | 3,249 | 70.05 s | 47.0 tok/s | 900 | 89.0 s | 0.21 GB | 10.58 GB |
|
| 182 |
-
| 8k | 7,673 | 165.11 s | 45.2 tok/s | 519 | 176.8 s | 0.27 GB | 11.03 GB |
|
| 183 |
-
|
| 184 |
-
**Needle-in-haystack recall at 8k: 3/3** (this superseded bundle). Three distinctive facts planted at 10/50/90% of
|
| 185 |
-
the filler, strict scoring; returned at 7,813 prompt tokens in a 27-token answer
|
| 186 |
-
(TTFT 168.09 s, 45.3 tok/s). 15k was not run on this superseded bundle (`mf64/` above passes 3/3 at 15k): its manifest ceiling is
|
| 187 |
-
8192, and S=1 prefill at that depth would cost roughly five minutes.
|
| 188 |
|
| 189 |
## Status
|
| 190 |
|
| 191 |
| Artifact | Status |
|
| 192 |
|---|---|
|
| 193 |
-
| `
|
| 194 |
-
| `mf64/lfm2_5_8b_a1b_decode_sym8_gather_mf64` | **QUALIFIED. Preferred bundle.** Measured: 10/10 guided parse and enum-clean, 51.9–53.5 tok/s decode, 7.70/4.71 s/row, 3/3 needle recall at both 8k and 15k, and non-empty free-form output with the chat template unmodified. Corrects both defects in `gpu-pipelined/`: adds the S=64 prefill entrypoint (prefill 21.5 → 6.3 ms/token) and terminates the reasoning block. Manifest context 16384. |
|
| 195 |
|
| 196 |
## License
|
| 197 |
|
|
|
|
| 18 |
|
| 19 |
# LFM2.5-8B-A1B — Core AI (.aimodel)
|
| 20 |
|
| 21 |
+
`LiquidAI/LFM2.5-8B-A1B` as a Core AI `.aimodel` bundle for Apple silicon, published by
|
| 22 |
+
[visible-cx](https://huggingface.co/visible-cx). `mf64/` is a re-export that adds the
|
| 23 |
+
S=64 chunked-prefill entrypoint and a terminated reasoning-block chat template; the
|
| 24 |
+
defective upstream mirror it replaces has been removed from this repo.
|
| 25 |
|
| 26 |
It is a **sparse mixture-of-experts** model: 8.3B total parameters, ~1.5B active per token.
|
| 27 |
24 layers — 18 short-convolution mixers and 6 GQA attention layers; the first two layers are
|
|
|
|
| 35 |
| | |
|
| 36 |
|---|---|
|
| 37 |
| Base checkpoint | `LiquidAI/LFM2.5-8B-A1B` |
|
|
|
|
| 38 |
| Zoo recipe | `models/lfm2.5-8b-a1b-moe/recipe.toml` → `["lfm2.5-8b-a1b"]`, `status = "verified"` |
|
| 39 |
+
| Recipe | `export_lfm2_moe_multifunction.py` — `metalize_moe_batched` installs `BatchedMetalSwitchGLU` |
|
| 40 |
| Producer fingerprint | `coreai-core 1.0.0b2` on every inner asset `metadata.json` |
|
| 41 |
+
| Asset creation date | `20260817T231316Z` |
|
| 42 |
| Weight format | **`sym8`** — symmetric-linear **int8**, per-K-block-32 scale, read through the `gather_qmm` Metal kernel |
|
| 43 |
| Vocab | 128,000 |
|
| 44 |
+
| Export functions | `main` (S=1 decode) + `prefill` (S=64) |
|
| 45 |
|
| 46 |
`sym8`, not int4. An `int4km-gather` variant exists upstream and is deliberately not
|
| 47 |
published: non-QAT int4 does not hold quality on this model (+12 output flips out of 41
|
| 48 |
against the fp16 reference), where `sym8` is clean (+1 flip out of 41, the fp16 ceiling).
|
| 49 |
|
| 50 |
+
Non-expert weights are the shipped int8 per-block-32 recipe calibrated on the decode spec.
|
| 51 |
+
`BatchedMetalSwitchGLU` serves S=64 by sorting (token, expert) pairs and falls back to the
|
| 52 |
+
q=1 gather path at S=1, so both entrypoints keep the gather kernel.
|
|
|
|
| 53 |
|
| 54 |
## Contents
|
| 55 |
|
| 56 |
| Path | Bytes | Files | Manifest context | Functions |
|
| 57 |
|---|---:|---|---|---|
|
|
|
|
| 58 |
| `mf64/lfm2_5_8b_a1b_decode_sym8_gather_mf64` | 9,447,767,758 | 7 | 16384 | main + prefill |
|
| 59 |
|
| 60 |
+
The folder holds `<name>.aimodel/` (`main.mlirb` ≈ 9.43 GB, `main.hash`, asset
|
| 61 |
`metadata.json`), a bundle-level `metadata.json`, and `tokenizer/` (`tokenizer.json`,
|
| 62 |
`tokenizer_config.json`, `chat_template.jinja`).
|
| 63 |
|
| 64 |
+
**Stop token:** `eos_token = "<|im_end|>"`.
|
| 65 |
|
| 66 |
+
## Chat template
|
| 67 |
|
| 68 |
+
LFM2.5-8B-A1B is an always-thinking model, so the generation prompt terminates the
|
| 69 |
+
reasoning block — `{{- "<|im_start|>assistant\n<think></think>\n" -}}`, the same form the
|
| 70 |
+
LFM2.5-2.6B bundles use. Free-form generation therefore returns text with the bundle
|
| 71 |
+
exactly as published (**4,561 characters** on the 3.4k measurement below) rather than
|
| 72 |
+
spending the whole budget inside an unterminated `<think>` block. Guided decoding is
|
| 73 |
+
unaffected either way, because the grammar forces structured output from the first token.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
## Requirements
|
| 76 |
|
|
|
|
| 78 |
an iPhone even with the memory-limit entitlement.
|
| 79 |
- **Engine contract: 2 inputs** (`input_ids`, `position_ids`) → logits. No static inputs,
|
| 80 |
no per-step mask.
|
| 81 |
+
- **Memory, measured:** max RSS **9.0–10.7 GB**, peak in-process
|
| 82 |
footprint 0.16–0.39 GB. **Minimum practical machine memory: 16 GB**, with little else
|
| 83 |
resident — the model runs on that tier but leaves almost no headroom. 24 GB or more is
|
| 84 |
the comfortable tier.
|
|
|
|
| 93 |
`reset()` between samples. Load excluded from `s/row`; sample 1 excluded as a cache-warm
|
| 94 |
outlier.
|
| 95 |
|
| 96 |
+
Chat template unmodified.
|
| 97 |
|
| 98 |
+
| | `mf64/` |
|
| 99 |
+
|---|---|
|
| 100 |
+
| Guided JSON parse | **10/10** |
|
| 101 |
+
| Enum-clean | **10/10** |
|
| 102 |
+
| s/row (long samples) | **7.70** |
|
| 103 |
+
| s/row (short samples) | **4.71** |
|
| 104 |
+
| Decode, guided | **51.9–53.5 tok/s** |
|
| 105 |
+
| TTFT, guided | **1.8–13.8 s** |
|
| 106 |
+
| Prefill | **6.3 ms/token** |
|
| 107 |
+
| Peak footprint | 0.39 GB |
|
| 108 |
+
| Max RSS | 9.04 GB |
|
|
|
|
|
|
|
| 109 |
|
| 110 |
Unguided, 900-token cap:
|
| 111 |
|
|
|
|
| 114 |
| 3.4k | 3,249 | **22.34 s** | 50.97 tok/s | 821 | **38.4 s** | 4,561 | 10.73 GB |
|
| 115 |
| 8k | 7,673 | **48.07 s** | 47.67 tok/s | 900 | **66.8 s** | 5,084 | 10.55 GB |
|
| 116 |
|
| 117 |
+
**Needle-in-haystack: 3/3 at 8k and 3/3 at 15k.** Three distinctive facts planted at
|
| 118 |
+
10/50/90 % of the filler, strict scoring. 8k: 7,813 prompt tokens, TTFT **49.60 s**. 15k:
|
| 119 |
+
14,566 prompt tokens, TTFT **91.41 s**, 44.63 tok/s, peak footprint 0.39 GB — reachable
|
| 120 |
+
because the manifest declares 16384 and the prefill entrypoint makes that depth practical.
|
| 121 |
+
Per-prompt-token prefill cost is the same 6.3 ms at 8k and 15k, so it is linear in depth.
|
|
|
|
| 122 |
|
| 123 |
**Cold-load caveat.** The first load of a freshly downloaded copy was **60.6 s**, since it
|
| 124 |
includes the graph compile. Subsequent loads were **22.9–26.2 s**. Budget roughly 17 GB of
|
| 125 |
on-disk compile cache in addition to the 9.4 GB bundle.
|
| 126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
Decode is healthy for the size — an MoE with ~1B active parameters decoding faster than a
|
| 128 |
+
dense 2.6B.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
|
| 130 |
## Status
|
| 131 |
|
| 132 |
| Artifact | Status |
|
| 133 |
|---|---|
|
| 134 |
+
| `mf64/lfm2_5_8b_a1b_decode_sym8_gather_mf64` | **QUALIFIED.** Measured: 10/10 guided parse and enum-clean, 51.9–53.5 tok/s decode, 7.70/4.71 s/row, 3/3 needle recall at both 8k and 15k, and non-empty free-form output with the chat template unmodified. Manifest context 16384. |
|
|
|
|
| 135 |
|
| 136 |
## License
|
| 137 |
|
gpu-pipelined/lfm2_5_8b_a1b_decode_sym8_gather/lfm2_5_8b_a1b_decode_sym8_gather.aimodel/main.hash
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
j{AC.��y���T�_%��B!{�!?qBu
|
|
|
|
|
|
gpu-pipelined/lfm2_5_8b_a1b_decode_sym8_gather/lfm2_5_8b_a1b_decode_sym8_gather.aimodel/main.mlirb
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:6a7b0c41432ed31f9e79ab869b10065496015f2590894201217bc4213f714275
|
| 3 |
-
size 9429620942
|
|
|
|
|
|
|
|
|
|
|
|
gpu-pipelined/lfm2_5_8b_a1b_decode_sym8_gather/lfm2_5_8b_a1b_decode_sym8_gather.aimodel/metadata.json
DELETED
|
@@ -1,5 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"assetVersion" : "2.0",
|
| 3 |
-
"producer" : "coreai-core 1.0.0b2",
|
| 4 |
-
"creationDate" : "20260718T140139Z"
|
| 5 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gpu-pipelined/lfm2_5_8b_a1b_decode_sym8_gather/metadata.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"metadata_version": "0.2",
|
| 3 |
-
"kind": "llm",
|
| 4 |
-
"name": "lfm2_5_8b_a1b_decode_sym8_gather",
|
| 5 |
-
"assets": {
|
| 6 |
-
"main": "lfm2_5_8b_a1b_decode_sym8_gather.aimodel"
|
| 7 |
-
},
|
| 8 |
-
"language": {
|
| 9 |
-
"tokenizer": "LiquidAI/LFM2.5-8B-A1B",
|
| 10 |
-
"vocab_size": 128000,
|
| 11 |
-
"max_context_length": 8192,
|
| 12 |
-
"embedded_tokenizer": true,
|
| 13 |
-
"function_map": {
|
| 14 |
-
"main": [
|
| 15 |
-
"main"
|
| 16 |
-
]
|
| 17 |
-
}
|
| 18 |
-
},
|
| 19 |
-
"source": {
|
| 20 |
-
"model_definition": "torch",
|
| 21 |
-
"hf_model_id": "LiquidAI/LFM2.5-8B-A1B"
|
| 22 |
-
},
|
| 23 |
-
"compression": null,
|
| 24 |
-
"compilation": {
|
| 25 |
-
"date": "2026-07-18T14:01:42.873532+00:00",
|
| 26 |
-
"targets": []
|
| 27 |
-
}
|
| 28 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gpu-pipelined/lfm2_5_8b_a1b_decode_sym8_gather/tokenizer/chat_template.jinja
DELETED
|
@@ -1,115 +0,0 @@
|
|
| 1 |
-
{{- bos_token -}}
|
| 2 |
-
{%- set preserve_thinking = preserve_thinking | default(false) -%}
|
| 3 |
-
|
| 4 |
-
{%- macro format_arg_value(arg_value) -%}
|
| 5 |
-
{%- if arg_value is string -%}
|
| 6 |
-
{{- "'" + arg_value + "'" -}}
|
| 7 |
-
{%- elif arg_value is mapping -%}
|
| 8 |
-
{{- arg_value | tojson -}}
|
| 9 |
-
{%- else -%}
|
| 10 |
-
{{- arg_value | string -}}
|
| 11 |
-
{%- endif -%}
|
| 12 |
-
{%- endmacro -%}
|
| 13 |
-
|
| 14 |
-
{%- macro parse_content(content) -%}
|
| 15 |
-
{%- if content is string -%}
|
| 16 |
-
{{- content -}}
|
| 17 |
-
{%- else -%}
|
| 18 |
-
{%- set _ns = namespace(result="") -%}
|
| 19 |
-
{%- for item in content -%}
|
| 20 |
-
{%- if item["type"] == "image" -%}
|
| 21 |
-
{%- set _ns.result = _ns.result + "<image>" -%}
|
| 22 |
-
{%- elif item["type"] == "text" -%}
|
| 23 |
-
{%- set _ns.result = _ns.result + item["text"] -%}
|
| 24 |
-
{%- else -%}
|
| 25 |
-
{%- set _ns.result = _ns.result + item | tojson -%}
|
| 26 |
-
{%- endif -%}
|
| 27 |
-
{%- endfor -%}
|
| 28 |
-
{{- _ns.result -}}
|
| 29 |
-
{%- endif -%}
|
| 30 |
-
{%- endmacro -%}
|
| 31 |
-
|
| 32 |
-
{%- macro render_tool_calls(tool_calls) -%}
|
| 33 |
-
{%- set tool_calls_ns = namespace(tool_calls=[]) -%}
|
| 34 |
-
{%- for tool_call in tool_calls -%}
|
| 35 |
-
{%- set func_name = tool_call["function"]["name"] -%}
|
| 36 |
-
{%- set func_args = tool_call["function"]["arguments"] -%}
|
| 37 |
-
{%- set args_ns = namespace(arg_strings=[]) -%}
|
| 38 |
-
{%- for arg_name, arg_value in func_args.items() -%}
|
| 39 |
-
{%- set args_ns.arg_strings = args_ns.arg_strings + [arg_name + "=" + format_arg_value(arg_value)] -%}
|
| 40 |
-
{%- endfor -%}
|
| 41 |
-
{%- set tool_calls_ns.tool_calls = tool_calls_ns.tool_calls + [func_name + "(" + (args_ns.arg_strings | join(", ")) + ")"] -%}
|
| 42 |
-
{%- endfor -%}
|
| 43 |
-
{{- "<|tool_call_start|>[" + (tool_calls_ns.tool_calls | join(", ")) + "]<|tool_call_end|>" -}}
|
| 44 |
-
{%- endmacro -%}
|
| 45 |
-
|
| 46 |
-
{%- set ns = namespace(system_prompt="", last_user_index=-1) -%}
|
| 47 |
-
{%- if messages[0]["role"] == "system" -%}
|
| 48 |
-
{%- if messages[0].get("content") -%}
|
| 49 |
-
{%- set ns.system_prompt = parse_content(messages[0]["content"]) -%}
|
| 50 |
-
{%- endif -%}
|
| 51 |
-
{%- set messages = messages[1:] -%}
|
| 52 |
-
{%- endif -%}
|
| 53 |
-
{%- if tools -%}
|
| 54 |
-
{%- set ns.system_prompt = ns.system_prompt + ("\n" if ns.system_prompt else "") + "List of tools: [" -%}
|
| 55 |
-
{%- for tool in tools -%}
|
| 56 |
-
{%- if tool is not string -%}
|
| 57 |
-
{%- set tool = tool | tojson -%}
|
| 58 |
-
{%- endif -%}
|
| 59 |
-
{%- set ns.system_prompt = ns.system_prompt + tool -%}
|
| 60 |
-
{%- if not loop.last -%}
|
| 61 |
-
{%- set ns.system_prompt = ns.system_prompt + ", " -%}
|
| 62 |
-
{%- endif -%}
|
| 63 |
-
{%- endfor -%}
|
| 64 |
-
{%- set ns.system_prompt = ns.system_prompt + "]" -%}
|
| 65 |
-
{%- endif -%}
|
| 66 |
-
{%- if ns.system_prompt -%}
|
| 67 |
-
{{- "<|im_start|>system\n" + ns.system_prompt + "<|im_end|>\n" -}}
|
| 68 |
-
{%- endif -%}
|
| 69 |
-
{%- for message in messages -%}
|
| 70 |
-
{%- if message["role"] == "user" -%}
|
| 71 |
-
{%- set ns.last_user_index = loop.index0 -%}
|
| 72 |
-
{%- endif -%}
|
| 73 |
-
{%- endfor -%}
|
| 74 |
-
{%- for message in messages -%}
|
| 75 |
-
{{- "<|im_start|>" + message.role + "\n" -}}
|
| 76 |
-
{%- if message.role == "assistant" -%}
|
| 77 |
-
{%- generation -%}
|
| 78 |
-
{%- if message.thinking is defined and (preserve_thinking or loop.index0 > ns.last_user_index) -%}
|
| 79 |
-
{{- "<think>" + message.thinking + "</think>" -}}
|
| 80 |
-
{%- endif -%}
|
| 81 |
-
{%- set _cfm_tag = "CONTINUE_FINAL_MESSAGE_TAG " -%}
|
| 82 |
-
{%- set _has_cfm = false -%}
|
| 83 |
-
{%- if message.content is defined -%}
|
| 84 |
-
{%- set content = parse_content(message.content) -%}
|
| 85 |
-
{%- if not (preserve_thinking or loop.index0 > ns.last_user_index) -%}
|
| 86 |
-
{%- if "</think>" in content -%}
|
| 87 |
-
{%- set content = content.split("</think>")[-1] | trim -%}
|
| 88 |
-
{%- endif -%}
|
| 89 |
-
{%- endif -%}
|
| 90 |
-
{%- if message.tool_calls is defined and content.endswith(_cfm_tag) -%}
|
| 91 |
-
{%- set _has_cfm = true -%}
|
| 92 |
-
{%- set _trunc_len = (content | length) - (_cfm_tag | length) -%}
|
| 93 |
-
{{- content[:_trunc_len] -}}
|
| 94 |
-
{%- else -%}
|
| 95 |
-
{{- content -}}
|
| 96 |
-
{%- endif -%}
|
| 97 |
-
{%- endif -%}
|
| 98 |
-
{%- if message.tool_calls is defined -%}
|
| 99 |
-
{{- render_tool_calls(message.tool_calls) -}}
|
| 100 |
-
{%- endif -%}
|
| 101 |
-
{%- if _has_cfm -%}
|
| 102 |
-
{{- _cfm_tag -}}
|
| 103 |
-
{%- endif -%}
|
| 104 |
-
{{- "<|im_end|>\n" -}}
|
| 105 |
-
{%- endgeneration -%}
|
| 106 |
-
{%- else %}
|
| 107 |
-
{%- if message.get("content") -%}
|
| 108 |
-
{{- parse_content(message["content"]) -}}
|
| 109 |
-
{%- endif -%}
|
| 110 |
-
{{- "<|im_end|>\n" -}}
|
| 111 |
-
{%- endif %}
|
| 112 |
-
{%- endfor -%}
|
| 113 |
-
{%- if add_generation_prompt -%}
|
| 114 |
-
{{- "<|im_start|>assistant\n" -}}
|
| 115 |
-
{%- endif -%}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gpu-pipelined/lfm2_5_8b_a1b_decode_sym8_gather/tokenizer/tokenizer.json
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:695be7802a0e4b8a81048f0ff5ebb7fc811a0ba5a6be63dbb24deb5a81096f41
|
| 3 |
-
size 17905598
|
|
|
|
|
|
|
|
|
|
|
|
gpu-pipelined/lfm2_5_8b_a1b_decode_sym8_gather/tokenizer/tokenizer_config.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"backend": "tokenizers",
|
| 3 |
-
"bos_token": "<|startoftext|>",
|
| 4 |
-
"clean_up_tokenization_spaces": false,
|
| 5 |
-
"eos_token": "<|im_end|>",
|
| 6 |
-
"is_local": true,
|
| 7 |
-
"model_max_length": 1000000000000000019884624838656,
|
| 8 |
-
"pad_token": "<|pad|>",
|
| 9 |
-
"tokenizer_class": "TokenizersBackend",
|
| 10 |
-
"use_default_system_prompt": false
|
| 11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|