GatekeeperZA commited on
Commit
3d5f9a3
Β·
1 Parent(s): fa3f68a

Add InternLM2-Chat-1.8B w8a8 RKLLM v1.2.3 for RK3588

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. InternLM2-1.8B-w8a8-rk3588.rkllm +3 -0
  3. README.md +194 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.rkllm filter=lfs diff=lfs merge=lfs -text
InternLM2-1.8B-w8a8-rk3588.rkllm ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d82b31a15c3a115873f82a4ea65294e9c0a36efbe6e4ee3e91a09807587dde83
3
+ size 2104702708
README.md ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: internlm-license
4
+ license_link: https://huggingface.co/internlm/internlm2-chat-1_8b/blob/main/LICENSE
5
+ base_model: internlm/internlm2-chat-1_8b
6
+ tags:
7
+ - internlm2
8
+ - rk3588
9
+ - npu
10
+ - rockchip
11
+ - quantized
12
+ - w8a8
13
+ - rkllm
14
+ - edge
15
+ language:
16
+ - en
17
+ - zh
18
+ pipeline_tag: text-generation
19
+ library_name: rkllm
20
+ ---
21
+
22
+ # InternLM2-Chat-1.8B β€” RKLLM v1.2.3 (w8a8, RK3588)
23
+
24
+ RKLLM conversion of [internlm/internlm2-chat-1_8b](https://huggingface.co/internlm/internlm2-chat-1_8b) for Rockchip RK3588 NPU inference.
25
+
26
+ Converted with **RKLLM Toolkit v1.2.3**. This model provides a different architecture option alongside Qwen3 models on the RK3588, offering strong multilingual support (English + Chinese) and good general-purpose chat capability at ~15.6 tokens/sec.
27
+
28
+ ## Key Details
29
+
30
+ | | |
31
+ |---|---|
32
+ | **Base Model** | internlm/internlm2-chat-1_8b |
33
+ | **Parameters** | 1.8B |
34
+ | **Toolkit Version** | RKLLM Toolkit v1.2.3 |
35
+ | **Runtime Version** | RKLLM Runtime β‰₯ v1.2.0 (v1.2.3 recommended) |
36
+ | **Quantization** | w8a8 (8-bit weights, 8-bit activations) |
37
+ | **Quantization Algorithm** | normal |
38
+ | **Target Platform** | RK3588 |
39
+ | **NPU Cores** | 3 |
40
+ | **Max Context Length** | 4,096 tokens |
41
+ | **Optimization Level** | 1 |
42
+ | **Thinking Mode** | ❌ Not supported (standard instruct model) |
43
+ | **Languages** | English, Chinese |
44
+
45
+ ## Performance (RK3588 Official Benchmark)
46
+
47
+ From the [RKLLM v1.2.3 benchmark](https://github.com/airockchip/rknn-llm/blob/main/benchmark.md) (w8a8, SeqLen=128, New_tokens=64):
48
+
49
+ | Metric | Value |
50
+ |--------|-------|
51
+ | **Decode Speed** | 15.58 tokens/sec |
52
+ | **Prefill (TTFT)** | 374 ms |
53
+ | **Memory Usage** | ~1,766 MB |
54
+
55
+ ## Why InternLM2-1.8B?
56
+
57
+ InternLM2 brings **architectural diversity** to an RK3588 model lineup. If you already run Qwen3 models, adding InternLM2 gives you a different model family with its own strengths:
58
+
59
+ - **Strong bilingual capability** β€” trained extensively on both English and Chinese data
60
+ - **Good instruction following** β€” RLHF-aligned for chat applications
61
+ - **Efficient memory usage** β€” ~1,766 MB is significantly less than 3-4B models (~3.7-4.3 GB)
62
+ - **Fast inference** β€” 15.58 tok/s is solidly in the "responsive chat" bracket
63
+ - **200K native context** β€” the base model supports ultra-long contexts (RKLLM conversion caps at 4K for NPU efficiency, but the architecture handles long dependencies well)
64
+
65
+ ### Benchmarks (Base Model)
66
+
67
+ | Benchmark | InternLM2-Chat-1.8B | InternLM2-1.8B (base) |
68
+ |-----------|---------------------|----------------------|
69
+ | MMLU | 47.1 | 46.9 |
70
+ | AGIEval | 38.8 | 33.4 |
71
+ | BBH | 35.2 | 37.5 |
72
+ | GSM8K | 39.7 | 31.2 |
73
+ | MATH | 11.8 | 5.6 |
74
+ | HumanEval | 32.9 | 25.0 |
75
+ | MBPP (Sanitized) | 23.2 | 22.2 |
76
+
77
+ Source: [OpenCompass](https://github.com/open-compass/opencompass)
78
+
79
+ ## Hardware Tested
80
+
81
+ - **Orange Pi 5 Plus** β€” RK3588, 16 GB RAM, Armbian Linux
82
+ - RKNPU driver 0.9.8
83
+ - RKLLM Runtime v1.2.3
84
+
85
+ ## Usage
86
+
87
+ ### 1. Download
88
+
89
+ Place the `.rkllm` file in a model directory on your RK3588 board:
90
+
91
+ ```bash
92
+ mkdir -p ~/models/InternLM2-1.8B
93
+ cd ~/models/InternLM2-1.8B
94
+ # Copy the .rkllm file into this directory
95
+ ```
96
+
97
+ ### 2. Run with the official RKLLM API demo
98
+
99
+ ```bash
100
+ # Clone the runtime
101
+ git clone https://github.com/airockchip/rknn-llm.git
102
+ cd rknn-llm/examples/rkllm_api_demo
103
+
104
+ # Run (aarch64)
105
+ ./build/rkllm_api_demo /path/to/InternLM2-1.8B-w8a8-rk3588.rkllm 2048 4096
106
+ ```
107
+
108
+ ### 3. Chat template
109
+
110
+ InternLM2 uses the following chat format:
111
+
112
+ ```
113
+ <|im_start|>system
114
+ You are a helpful assistant.<|im_end|>
115
+ <|im_start|>user
116
+ How does photosynthesis work?<|im_end|>
117
+ <|im_start|>assistant
118
+ ```
119
+
120
+ The RKLLM runtime handles this automatically β€” no manual template needed.
121
+
122
+ ### 4. With a custom OpenAI-compatible server
123
+
124
+ Any server that wraps the RKLLM binary/library will work. The model responds to standard chat completion requests. See the [RKLLM API Server](https://github.com/GatekeeperZA/RKLLM-API-Server) project for a full OpenAI-compatible implementation with multi-model support.
125
+
126
+ ## Conversion Script
127
+
128
+ ```python
129
+ from rkllm.api import RKLLM
130
+
131
+ model_path = "internlm/internlm2-chat-1_8b" # or local path
132
+ output_path = "./InternLM2-1.8B-w8a8-rk3588.rkllm"
133
+ dataset_path = "./data_quant.json" # calibration data
134
+
135
+ # Load
136
+ llm = RKLLM()
137
+ llm.load_huggingface(model=model_path, model_lora=None, device="cpu")
138
+
139
+ # Build
140
+ llm.build(
141
+ do_quantization=True,
142
+ optimization_level=1,
143
+ quantized_dtype="w8a8",
144
+ quantized_algorithm="normal",
145
+ target_platform="rk3588",
146
+ num_npu_core=3,
147
+ extra_qparams=None,
148
+ dataset=dataset_path,
149
+ max_context=4096,
150
+ )
151
+
152
+ # Export
153
+ llm.export_rkllm(output_path)
154
+ ```
155
+
156
+ Calibration dataset: 21 diverse prompt/completion pairs generated with `generate_data_quant.py` from the [rknn-llm examples](https://github.com/airockchip/rknn-llm/tree/main/examples/rkllm_api_demo/export).
157
+
158
+ ## File Listing
159
+
160
+ | File | Description |
161
+ |------|-------------|
162
+ | `InternLM2-1.8B-w8a8-rk3588.rkllm` | Quantized model for RK3588 NPU |
163
+
164
+ ## Compatibility Notes
165
+
166
+ - **Minimum runtime:** RKLLM Runtime v1.2.0. v1.2.3 recommended.
167
+ - **RKNPU driver:** β‰₯ 0.9.6
168
+ - **SoCs:** RK3588 / RK3588S (3 NPU cores). Not compatible with RK3576 (2 cores) without reconversion.
169
+ - **RAM:** ~1.8 GB loaded. Runs comfortably on 8 GB+ boards.
170
+ - **No thinking mode:** InternLM2 is a standard instruct/chat model β€” it does not produce `<think>…</think>` reasoning blocks. For thinking mode, use [Qwen3-1.7B-RKLLM-v1.2.3](https://huggingface.co/GatekeeperZA/Qwen3-1.7B-RKLLM-v1.2.3).
171
+
172
+ ## Known Issues
173
+
174
+ - The folder name containing the model must **not** include dots (e.g., `InternLM2-1.8B` not `InternLM2.1.8B`) due to Python module import issues during conversion.
175
+ - InternLM2 uses a custom tokenizer (`trust_remote_code=True` required during conversion).
176
+
177
+ ## Acknowledgements
178
+
179
+ - [InternLM Team (Shanghai AI Laboratory)](https://huggingface.co/internlm) for the base model
180
+ - [Rockchip / airockchip](https://github.com/airockchip/rknn-llm) for the RKLLM toolkit and runtime
181
+ - Converted by [GatekeeperZA](https://huggingface.co/GatekeeperZA)
182
+
183
+ ## Citation
184
+
185
+ ```bibtex
186
+ @misc{cai2024internlm2,
187
+ title={InternLM2 Technical Report},
188
+ author={Zheng Cai and Maosong Cao and Haojiong Chen and Kai Chen and others},
189
+ year={2024},
190
+ eprint={2403.17297},
191
+ archivePrefix={arXiv},
192
+ primaryClass={cs.CL}
193
+ }
194
+ ```