Model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model:
|
| 4 |
+
- openbmb/MiniCPM5-2B
|
| 5 |
+
- openbmb/MiniCPM5-2B-DSpark
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
language:
|
| 8 |
+
- en
|
| 9 |
+
- zh
|
| 10 |
+
tags:
|
| 11 |
+
- radiance
|
| 12 |
+
- rocm
|
| 13 |
+
- amd
|
| 14 |
+
- rdna4
|
| 15 |
+
- bf16
|
| 16 |
+
- speculative-decoding
|
| 17 |
+
- dspark
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# MiniCPM5-2B BF16 + DSpark — radiance container
|
| 21 |
+
|
| 22 |
+
[openbmb/MiniCPM5-2B](https://huggingface.co/openbmb/MiniCPM5-2B) in bf16, exactly as the checkpoint
|
| 23 |
+
ships it, as a single `.rad` container for the **radiance** inference engine (AMD RDNA4, ROCm), with
|
| 24 |
+
the [MiniCPM5-2B-DSpark](https://huggingface.co/openbmb/MiniCPM5-2B-DSpark) block drafter merged in
|
| 25 |
+
for speculative decoding. An FP8 version is at
|
| 26 |
+
[StillDeadcode/minicpm5-2b-fp8](https://huggingface.co/StillDeadcode/minicpm5-2b-fp8).
|
| 27 |
+
|
| 28 |
+
| | |
|
| 29 |
+
|---|---|
|
| 30 |
+
| File | `minicpm5-2b-bf16.rad` — 5.12 GiB |
|
| 31 |
+
| Weights | every weight of the model, the lm_head included, bf16 as the checkpoint ships it |
|
| 32 |
+
| Speculator | DSpark (5 layers, block size 7). Its weights are FP8 E4M3 per 128×128 block and its vocabulary head 2-bit codes, the one form the engine's DSpark block reads; the drafter only proposes, and the bf16 model verifies every token it emits |
|
| 33 |
+
| Context | 131,072 tokens (the checkpoint's trained length) |
|
| 34 |
+
| Modalities | text |
|
| 35 |
+
|
| 36 |
+
## Serve
|
| 37 |
+
|
| 38 |
+
```sh
|
| 39 |
+
radiance --model minicpm5-2b-bf16.rad --tp 2 --max-model-len 131072 --kv-cache-dtype fp8 \
|
| 40 |
+
--max-num-seqs 8 --host 0.0.0.0 --port 8000
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
`--tp 1` serves it on one card. The server speaks the OpenAI API (`/v1/chat/completions`, `/v1/completions`), with tool calls and
|
| 44 |
+
structured output; the drafter's
|
| 45 |
+
depth is chosen automatically (`--num-speculative-tokens N` states one, `0` turns speculation off).
|
| 46 |
+
|
| 47 |
+
Built and tested on Radeon AI PRO R9700 (gfx1201).
|
| 48 |
+
|
| 49 |
+
## How this file was made
|
| 50 |
+
|
| 51 |
+
The exact command, with the radiance image built by `docker/build.sh` from radiance commit 93bbe22:
|
| 52 |
+
|
| 53 |
+
```sh
|
| 54 |
+
docker run --rm --user 1000:1000 -v ~/models:/models --entrypoint rad-convert radiance:93bbe224b392 \
|
| 55 |
+
/models/openbmb/MiniCPM5-2B --draft-model /models/openbmb/MiniCPM5-2B-DSpark \
|
| 56 |
+
--tokenizer /models/openbmb/MiniCPM5-2B/tokenizer.json \
|
| 57 |
+
--recipe /opt/radiance/share/radiance/recipes/minicpm5-2b-bf16-dspark.recipe \
|
| 58 |
+
-o /models/rad/minicpm5-2b-bf16.rad
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
Running it twice gives byte-identical files. The recipe (`rad-info --recipe minicpm5-2b-bf16.rad`)
|
| 62 |
+
quantises the drafter only:
|
| 63 |
+
|
| 64 |
+
```
|
| 65 |
+
dspark.draft_head.weight rtn codes=u2 zero=u8 group=128 scale=f16
|
| 66 |
+
dspark.fc.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
| 67 |
+
dspark.blk.*.attn_q.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
| 68 |
+
dspark.blk.*.attn_k.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
| 69 |
+
dspark.blk.*.attn_v.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
| 70 |
+
dspark.blk.*.attn_output.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
| 71 |
+
dspark.blk.*.ffn_gate_up.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
| 72 |
+
dspark.blk.*.ffn_down.weight rtn codes=fp8_e4m3 block=128x128 scale=bf16
|
| 73 |
+
```
|