yongqiang commited on
Commit
adf420c
·
1 Parent(s): 59d74f7

Rewrite README for release format

Browse files
Files changed (1) hide show
  1. README.md +184 -64
README.md CHANGED
@@ -2,75 +2,69 @@
2
  library_name: transformers
3
  license: apache-2.0
4
  base_model:
5
- - openbmb/MiniCPM5-1B
6
  pipeline_tag: text-generation
7
  tags:
8
- - minicpm
9
- - llm
10
- - axera
11
- - AX650
 
12
  language:
13
- - zh
14
- - en
15
  ---
16
 
17
  # MiniCPM5-1B on AXERA NPU
18
 
19
- Ready-to-run AX650 deployment package for `openbmb/MiniCPM5-1B`.
20
 
21
- - Runtime: `axllm serve` and `axllm run`
22
- - Target: `AX650 / AX650N aarch64`
23
- - Model type: text-only LLM
24
- - Context layout: `prefill_len=128`, `kv_cache_len=2047`, `prefill_max_token_num=1280`
25
- - Default generation mode: `enable_thinking=false`
26
- - Included board binary: `bin/axllm`
27
-
28
- This package has been validated through the OpenAI-compatible `axllm serve` API.
29
 
30
  ## Supported Platform
31
 
32
- - [x] AX650 / AX650N
33
 
34
- ## Capability
35
 
36
- MiniCPM5-1B in this package is a pure text model.
37
 
38
- - Text chat: supported
39
- - Multi-turn text chat: supported
40
- - Image, video, and audio inputs: not supported
41
 
42
- ## Performance and Footprint
43
 
44
- Measurements below were taken on AX650 / NPU3 with the packaged `axllm` binary. `TTFT` means time to first token. In this table, `TTFT` is measured end-to-end from request arrival at `axllm serve` to the first generated token.
45
 
46
- The validated text prompts below were kept within one `128`-token prefill chunk. To avoid one-time startup effects, each `TTFT` row excludes the first request for that prompt pattern. Sustained text-only `Decode` throughput was measured separately with longer text-only generations (`max_tokens=256`).
47
 
48
  | Scenario | Input tokens | Prefill chunks | TTFT | Decode |
49
  |---|---:|---:|---:|---:|
50
- | Text smoke prompt | `24` | `1 x 128` | `160.34 ms avg` (`159.40-161.28 ms`) | `17.96 token/s avg` |
51
  | Short front-end prompt | `14` | `1 x 128` | `157.76 ms avg` (`157.68-157.84 ms`) | `n/a (short reply)` |
52
  | Multi-turn text prompt | `40` | `1 x 128` | `159.89 ms avg` (`159.19-160.59 ms`) | `n/a (short reply)` |
 
53
 
54
- ### Flash Footprint
55
-
56
- | Item | Value |
57
- |---|---:|
58
- | Text + post axmodels | `1.4 GiB` |
59
- | Full package, excluding `.git` | `1.9 GiB` |
60
 
61
- ### Startup Runtime Footprint
 
 
62
 
63
- The startup log records `remain_cmm(6692 MB)` after the post axmodel was initialized.
64
 
65
- Runtime layout from the same log:
66
 
67
  | Item | Value |
68
  |---|---:|
69
- | `max_token_len` | `2047` |
70
- | `kv_cache_size` | `256` |
71
- | `kv_cache_num` | `2047` |
72
- | `prefill_token_num` | `128` |
73
- | `prefill_max_token_num` | `1280` |
74
 
75
  ## Package Layout
76
 
@@ -80,25 +74,72 @@ Runtime layout from the same log:
80
  ├── bin/
81
  │ ├── axllm
82
  │ └── axllm.version.json
 
 
 
 
83
  ├── llama_p128_l0_together.axmodel
84
  ├── ...
85
  ├── llama_p128_l23_together.axmodel
86
- ├── llama_post.axmodel
87
- ├── model.embed_tokens.weight.bfloat16.bin
88
- ├── config.json
89
- ├── post_config.json
90
- └── minicpm5_tokenizer.txt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  ```
92
 
93
- The runtime files are placed at the repository root so the package can be served directly by `axllm`.
94
 
95
- ## Run on AX650
96
 
97
- From the repository root on the board:
98
 
99
  ```bash
100
  chmod +x ./bin/axllm
101
- ./bin/axllm serve .
102
  ```
103
 
104
  Expected model id:
@@ -107,15 +148,42 @@ Expected model id:
107
  AXERA-TECH/MiniCPM5-1B-AX650-C128-P1152-CTX2047
108
  ```
109
 
110
- Health check:
111
 
112
  ```bash
113
  curl http://127.0.0.1:8000/health
 
 
 
 
 
 
 
 
 
 
 
114
  ```
115
 
116
- ## Chat Request
117
 
118
- Default behavior uses no-thinking mode because `config.json` sets `enable_thinking=false`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
 
120
  ```bash
121
  curl http://127.0.0.1:8000/v1/chat/completions \
@@ -123,18 +191,37 @@ curl http://127.0.0.1:8000/v1/chat/completions \
123
  -d '{
124
  "model": "AXERA-TECH/MiniCPM5-1B-AX650-C128-P1152-CTX2047",
125
  "messages": [
126
- {"role": "user", "content": "1+1等于几?请简短回答。"}
 
 
 
127
  ],
128
  "max_tokens": 32,
129
  "temperature": 0
130
  }'
131
  ```
132
 
133
- This default request does not emit `<think>...</think>` markup.
134
 
135
- ## Enable Thinking Per Request
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
 
137
- Use top-level `enable_thinking=true`:
 
 
138
 
139
  ```bash
140
  curl http://127.0.0.1:8000/v1/chat/completions \
@@ -142,17 +229,36 @@ curl http://127.0.0.1:8000/v1/chat/completions \
142
  -d '{
143
  "model": "AXERA-TECH/MiniCPM5-1B-AX650-C128-P1152-CTX2047",
144
  "messages": [
145
- {"role": "user", "content": "中国的首都是哪里?请先思考,再给出简短答案。"}
 
 
 
146
  ],
147
  "enable_thinking": true,
148
- "max_tokens": 128,
149
  "temperature": 0
150
  }'
151
  ```
152
 
153
- When thinking is enabled, the API returns explicit `<think>...</think>` markup so clients can render reasoning and final answer separately.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
 
155
- The compatible HuggingFace-style form is also accepted:
156
 
157
  ```json
158
  {
@@ -162,8 +268,22 @@ The compatible HuggingFace-style form is also accepted:
162
  }
163
  ```
164
 
165
- ## Notes
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
 
167
- - Previous assistant `<think>...</think>` content is stripped from normal chat history before the next user turn, matching the official MiniCPM5 template behavior.
168
- - If a thinking response reaches `max_tokens` before the model emits `</think>`, `axllm` closes the client-visible thinking block before finishing the response stream.
169
- - This release does not include the original HuggingFace `safetensors` weights.
 
2
  library_name: transformers
3
  license: apache-2.0
4
  base_model:
5
+ - openbmb/MiniCPM5-1B
6
  pipeline_tag: text-generation
7
  tags:
8
+ - minicpm5
9
+ - llm
10
+ - thinking
11
+ - axera
12
+ - ax650
13
  language:
14
+ - en
15
+ - zh
16
  ---
17
 
18
  # MiniCPM5-1B on AXERA NPU
19
 
20
+ Ready-to-run deployment package for `openbmb/MiniCPM5-1B` on AX650 / NPU3.
21
 
22
+ - This release packages the AX650 `axllm` runtime together with the compiled text `.axmodel` files.
23
+ - The packaged runtime is configured for text-only inference on AX650 / NPU3.
24
+ - The packaged context layout is `prefill_len=128`, `kv_cache_len=2047`, and `prefill_max_token_num=1280`.
25
+ - Thinking is disabled by default and can be enabled per request through the public OpenAI-compatible API.
26
+ - The package includes the tokenizer, runtime config files, and the validated `bin/axllm` binary for board-side deployment.
 
 
 
27
 
28
  ## Supported Platform
29
 
30
+ - [x] AX650 / NPU3
31
 
32
+ ## Validated Devices
33
 
34
+ This package has been validated on the following AX650-based device:
35
 
36
+ - AX650 / NPU3 development board
 
 
37
 
38
+ ## Performance
39
 
40
+ All measurements below were taken on AX650 / NPU3 with the packaged `axllm` runtime. `TTFT` stands for time to first token. In this table, `TTFT` is measured end-to-end from request arrival at `axllm serve` to the first generated token.
41
 
42
+ The validated text prompts below were kept within one `128`-token prefill chunk. To avoid one-time startup effects, each `TTFT` row excludes the first request for that prompt pattern.
43
 
44
  | Scenario | Input tokens | Prefill chunks | TTFT | Decode |
45
  |---|---:|---:|---:|---:|
46
+ | Text smoke prompt | `24` | `1 x 128` | `160.34 ms avg` (`159.40-161.28 ms`) | `n/a (single-token reply)` |
47
  | Short front-end prompt | `14` | `1 x 128` | `157.76 ms avg` (`157.68-157.84 ms`) | `n/a (short reply)` |
48
  | Multi-turn text prompt | `40` | `1 x 128` | `159.89 ms avg` (`159.19-160.59 ms`) | `n/a (short reply)` |
49
+ | Long text generation reference | `30` | `1 x 128` | `159.91 ms avg` (`159.34-160.49 ms`) | `17.96 token/s avg` |
50
 
51
+ The packaged runtime uses the following context layout:
 
 
 
 
 
52
 
53
+ - `prefill_len=128`
54
+ - `kv_cache_len=2047`
55
+ - `prefill_max_token_num=1280`
56
 
57
+ The `Long text generation reference` row is the recommended sustained text-only decode figure for this package. Very short replies under-report decode speed because EOS and response-tail overhead become relatively larger.
58
 
59
+ ## Startup Runtime Footprint
60
 
61
  | Item | Value |
62
  |---|---:|
63
+ | `Flash total (24 text axmodels + post axmodel + embedding bin)` | `1.42 GiB` (`1456.71 MiB`) |
64
+ | `Package flash total (excluding .git/)` | `1.43 GiB` (`1464.24 MiB`) |
65
+ | `Runtime CMM requirement` | `Board-dependent; validate on your target AX650 CMM pool` |
66
+
67
+ On the validated AX650 board, the packaged startup log confirmed `max_token_len=2047`, `prefill_len=128`, and `prefill_max_token_num=1280`. This README does not present one board's `remain_cmm(...)` value as a package-wide memory requirement, because the absolute remaining CMM pool depends on the board's global memory layout.
68
 
69
  ## Package Layout
70
 
 
74
  ├── bin/
75
  │ ├── axllm
76
  │ └── axllm.version.json
77
+ ├── config.json
78
+ ├── post_config.json
79
+ ├── minicpm5_tokenizer.txt
80
+ ├── model.embed_tokens.weight.bfloat16.bin
81
  ├── llama_p128_l0_together.axmodel
82
  ├── ...
83
  ├── llama_p128_l23_together.axmodel
84
+ └── llama_post.axmodel
85
+ ```
86
+
87
+ This package uses a flat runtime layout. The packaged `axllm` binary reads the root-level runtime files directly, so no extra path arguments are required when you serve the repository root.
88
+
89
+ ## Direct Inference with `axllm`
90
+
91
+ ### Download the Model Package
92
+
93
+ Download the release package from Hugging Face:
94
+
95
+ ```shell
96
+ mkdir -p AXERA-TECH/MiniCPM5-1B
97
+ cd AXERA-TECH/MiniCPM5-1B
98
+ hf download AXERA-TECH/MiniCPM5-1B --local-dir .
99
+ ```
100
+
101
+ ### Install `axllm`
102
+
103
+ Option 1: use the validated binary included in this repository:
104
+
105
+ ```bash
106
+ chmod +x ./bin/axllm
107
+ ```
108
+
109
+ Option 2: install `axllm` from the public repository:
110
+
111
+ ```shell
112
+ git clone -b axllm https://github.com/AXERA-TECH/ax-llm.git
113
+ cd ax-llm
114
+ ./install.sh
115
+ ```
116
+
117
+ Option 3: install with a one-line command:
118
+
119
+ ```shell
120
+ curl -fsSL https://raw.githubusercontent.com/AXERA-TECH/ax-llm/axllm/install.sh | bash
121
+ ```
122
+
123
+ Option 4: download the prebuilt binary from GitHub Actions CI:
124
+
125
+ If you do not have a local build environment, download the latest CI-generated `axllm` binary from GitHub Actions:
126
+ `https://github.com/AXERA-TECH/ax-llm/actions?query=branch%3Aaxllm`
127
+ Then run:
128
+
129
+ ```shell
130
+ chmod +x axllm
131
+ sudo mv axllm /usr/bin/axllm
132
  ```
133
 
134
+ ### Run on the Board
135
 
136
+ This package already includes a validated `bin/axllm` binary for AX650.
137
 
138
+ From the package root on the board:
139
 
140
  ```bash
141
  chmod +x ./bin/axllm
142
+ ./bin/axllm serve . --port 8000
143
  ```
144
 
145
  Expected model id:
 
148
  AXERA-TECH/MiniCPM5-1B-AX650-C128-P1152-CTX2047
149
  ```
150
 
151
+ Health check and model listing:
152
 
153
  ```bash
154
  curl http://127.0.0.1:8000/health
155
+ curl http://127.0.0.1:8000/v1/models
156
+ ```
157
+
158
+ Example health output:
159
+
160
+ ```json
161
+ {
162
+ "concurrency": 0,
163
+ "max_concurrency": 1,
164
+ "status": "healthy"
165
+ }
166
  ```
167
 
168
+ Example model list output:
169
 
170
+ ```json
171
+ {
172
+ "data": [
173
+ {
174
+ "created": 1780908633,
175
+ "id": "AXERA-TECH/MiniCPM5-1B-AX650-C128-P1152-CTX2047",
176
+ "object": "model",
177
+ "owned_by": "openai-api"
178
+ }
179
+ ],
180
+ "object": "list"
181
+ }
182
+ ```
183
+
184
+ ### Text Request
185
+
186
+ By default, this package uses no-thinking mode because the packaged `config.json` sets `enable_thinking=false`.
187
 
188
  ```bash
189
  curl http://127.0.0.1:8000/v1/chat/completions \
 
191
  -d '{
192
  "model": "AXERA-TECH/MiniCPM5-1B-AX650-C128-P1152-CTX2047",
193
  "messages": [
194
+ {
195
+ "role": "user",
196
+ "content": "中国的首都是哪里?请只回答城市名。"
197
+ }
198
  ],
199
  "max_tokens": 32,
200
  "temperature": 0
201
  }'
202
  ```
203
 
204
+ Example output:
205
 
206
+ ```json
207
+ {
208
+ "choices": [
209
+ {
210
+ "message": {
211
+ "role": "assistant",
212
+ "content": "北京"
213
+ },
214
+ "finish_reason": "stop"
215
+ }
216
+ ],
217
+ "model": "AXERA-TECH/MiniCPM5-1B-AX650-C128-P1152-CTX2047",
218
+ "object": "chat.completion"
219
+ }
220
+ ```
221
 
222
+ ### Enable Thinking Per Request
223
+
224
+ To enable explicit reasoning output for a single request, pass top-level `enable_thinking=true`:
225
 
226
  ```bash
227
  curl http://127.0.0.1:8000/v1/chat/completions \
 
229
  -d '{
230
  "model": "AXERA-TECH/MiniCPM5-1B-AX650-C128-P1152-CTX2047",
231
  "messages": [
232
+ {
233
+ "role": "user",
234
+ "content": "中国的首都是哪里?请简短思考后给最终答案。"
235
+ }
236
  ],
237
  "enable_thinking": true,
238
+ "max_tokens": 384,
239
  "temperature": 0
240
  }'
241
  ```
242
 
243
+ Typical output shape:
244
+
245
+ ```json
246
+ {
247
+ "choices": [
248
+ {
249
+ "message": {
250
+ "role": "assistant",
251
+ "content": "<think>\n...\n</think>\n\n中国的首都是北京。"
252
+ },
253
+ "finish_reason": "stop"
254
+ }
255
+ ],
256
+ "model": "AXERA-TECH/MiniCPM5-1B-AX650-C128-P1152-CTX2047",
257
+ "object": "chat.completion"
258
+ }
259
+ ```
260
 
261
+ The Hugging Face-style request form is also accepted:
262
 
263
  ```json
264
  {
 
268
  }
269
  ```
270
 
271
+ When thinking mode is enabled, the service returns client-visible `<think>...</think>` markup so front ends can render reasoning and final answer separately. Follow-up turns also keep the official MiniCPM5 template behavior: previous assistant reasoning content is not reinserted into the next user prompt.
272
+
273
+ ## Browser UI with `lite_webui`
274
+
275
+ If you want a browser UI for the OpenAI-compatible service started by `axllm serve`, use [AXERA-TECH/lite_webui](https://huggingface.co/AXERA-TECH/lite_webui/tree/main).
276
+
277
+ Set the OpenAI base URL to `http://<board-ip>:8000` and the model name to `AXERA-TECH/MiniCPM5-1B-AX650-C128-P1152-CTX2047`.
278
+
279
+ ## Conversion References
280
+
281
+ If you need the original model files or want to rebuild the deployment artifacts, start with:
282
+
283
+ - Original Hugging Face model: [openbmb/MiniCPM5-1B](https://huggingface.co/openbmb/MiniCPM5-1B)
284
+ - AXERA conversion and deployment workflow: [AXERA-TECH/MiniCPM5-1B.axera](https://github.com/AXERA-TECH/MiniCPM5-1B.axera)
285
+
286
+ ## Discussion
287
 
288
+ - GitHub Issues
289
+ - QQ group: `139953715`