|
Download README.md from FastFlowLM/Inkling-2-Mini-NPU2: direct link, hf CLI and curl.
- Browser
- Download file 3.81 kB
-
https://huggingface.co/FastFlowLM/Inkling-2-Mini-NPU2/resolve/main/README.md
- Command line
-
hf download hf://FastFlowLM/Inkling-2-Mini-NPU2/README.md
-
curl -L -o README.md https://huggingface.co/FastFlowLM/Inkling-2-Mini-NPU2/resolve/main/README.md
3.81 kB
| license: apache-2.0 | |
| license_link: https://www.apache.org/licenses/LICENSE-2.0 | |
| pipeline_tag: image-text-to-text | |
| library_name: flm | |
| base_model: | |
| - thinkingmachines/Inkling-2-Mini | |
| tags: | |
| - conversational | |
| - moe | |
| - npu | |
| - fastflowlm | |
| - q4nx | |
| # Inkling-2-Mini-NPU2 | |
| [Inkling 2 Mini](https://huggingface.co/thinkingmachines/Inkling-2-Mini) from Thinking Machines Lab, quantized for the | |
| AMD XDNA 2 NPU and run by [FastFlowLM](https://github.com/FastFlowLM/FastFlowLM) (`flm`). The files are in FLM's | |
| `q4nx` format and are not loadable by other runtimes. | |
| - Base model: [thinkingmachines/Inkling-2-Mini](https://huggingface.co/thinkingmachines/Inkling-2-Mini) | |
| (26.4B parameters, 5.4B active per token, 128 routed experts with 8 active, 24 layers of which the middle 12 run | |
| three times with shared weights, up to 1M context) | |
| - License: Apache 2.0, the same as the base model | |
| - This package: text and image in, text out (audio input of the base model is not part of this package) | |
| - Requires FLM >= v1.0.14 (the first release that supports this model) | |
| - Run: `flm run inkling-2:mini` or `flm serve inkling-2:mini` | |
| ## Quantization | |
| | Weights | Format | | |
| | :--- | :--- | | |
| | Attention, dense and expert projections | Q4_K (4.5 bits per weight) | | |
| | Expert down projections | Q4_K, input dimension padded 1152 to 1280 | | |
| | lm_head | Q8_0 | | |
| | Token embedding | BF16 | | |
| | Router, loop controllers | FP32 | | |
| | Short convolutions, sink projections | BF16 | | |
| The package is 17.3 GB. Decode, including the lm_head, runs on the NPU. | |
| ### Image input | |
| The vision tower (23 layers, 1,024 wide, with the 2x2 patch merger to the language model's 2,304) is in `vision_weight.q4nx` | |
| (0.64 GB) in BF16 and is not quantized. Its matrix multiplications and attention run on the NPU in bfp16 (weights and | |
| activations rounded to bfp16), the rest on the CPU. Images are not resized: each 40 x 40 pixel cell is | |
| one image token, up to 4,096 tokens per image (2560 x 2560 pixels); a larger image is scaled down to fit | |
| (`FLM_INKLING2_IMAGE_MAX_TOKENS` changes the limit, 0 removes it). | |
| Image embeddings against the BF16 reference model, 48 to 4,096 image tokens: relative L2 error 0.11 to 0.15 (the reference | |
| in bf16 itself is 0.06 away from fp32). Answers to our test questions (reading dates and headlines, describing photos) | |
| agree with llama.cpp running the BF16 model. Encoding takes about 0.3 s for a 640 x 480 image (192 tokens), 0.6 s at 525 | |
| tokens and 7.6 s at 4,096 tokens, the attention growing with the square of the token count. | |
| ### Importance matrix from unsloth | |
| The Q4_K scales and minima were chosen with an **importance matrix (imatrix) from [unsloth](https://huggingface.co/unsloth)**, | |
| the file `imatrix_unsloth.gguf_file` in | |
| [unsloth/Inkling-2-Mini-GGUF](https://huggingface.co/unsloth/Inkling-2-Mini-GGUF) (Apache 2.0). It was computed on | |
| unsloth's calibration set for this model (`unsloth_calibration_Inkling-2-Mini.conv.jsonl`). We did not compute it and | |
| we thank unsloth for publishing it. | |
| The imatrix only changes how each block's scale and minimum are rounded. The format, the file size and the speed are | |
| the same as an unweighted Q4_K quantization. Each expert is weighted by its own per-expert statistics, and the 128 | |
| padded columns of the expert down projections weigh zero. | |
| Measured against the BF16 model on 32 × 512 tokens (mean KL divergence of the next-token distribution, lower is better): | |
| | Text | Q4_K | Q4_K with the unsloth imatrix | | |
| | :--- | ---: | ---: | | |
| | wikitext-2 | 0.0184 | 0.0162 (-12%) | | |
| | code and documentation (not in the calibration set) | 0.0135 | 0.0115 (-15%) | | |
| The 99.9th-percentile KL divergence drops by about 25% on both sets. | |
| ## Credits | |
| - Model: Thinking Machines Lab, Inc. (Apache 2.0) | |
| - Importance matrix and calibration set: unsloth | |
| - Quantization and NPU runtime: FastFlowLM | |