qqc1989 commited on
Commit
e01b8f5
Β·
verified Β·
1 Parent(s): e7153df

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +172 -3
README.md CHANGED
@@ -1,3 +1,172 @@
1
- ---
2
- license: bsd-3-clause
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ license: bsd-3-clause
4
+ base_model:
5
+ - Qwen/Qwen2.5-7B-Instruct-GPTQ-Int4
6
+ tags:
7
+ - Qwen
8
+ - Qwen2.5-7B-Instruct
9
+ - Qwen2.5-7B-Instruct-GPTQ-Int4
10
+ - GPTQ
11
+ - Int4
12
+ ---
13
+
14
+ # Qwen2.5-3B-Instruct-GPTQ-Int4
15
+
16
+ This version of Qwen2.5-7B-Instruct-GPTQ-Int4 has been converted to run on the Axera NPU using **w4a16** quantization.
17
+
18
+ This model has been optimized with the following LoRA:
19
+
20
+ Compatible with Pulsar2 version: 3.4(Not released yet)
21
+
22
+ ## Convert tools links:
23
+
24
+ For those who are interested in model conversion, you can try to export axmodel through the original repo : https://huggingface.co/Qwen/Qwen2.5-7B-Instruct-GPTQ-Int4
25
+
26
+ [Pulsar2 Link, How to Convert LLM from Huggingface to axmodel](https://pulsar2-docs.readthedocs.io/en/latest/appendix/build_llm.html)
27
+
28
+ [AXera NPU LLM Runtime](https://github.com/AXERA-TECH/ax-llm)
29
+
30
+ ## Support Platform
31
+
32
+ - AX650
33
+ - AX650N DEMO Board
34
+ - [M4N-Dock(爱芯派Pro)](https://wiki.sipeed.com/hardware/zh/maixIV/m4ndock/m4ndock.html)
35
+ - [M.2 Accelerator card](https://axcl-docs.readthedocs.io/zh-cn/latest/doc_guide_hardware.html)
36
+ - AX630C
37
+ - *developing*
38
+
39
+ |Chips|w8a16|w4a16|
40
+ |--|--|--|
41
+ |AX650| 2.6 tokens/sec|4.8 tokens/sec|
42
+
43
+ ## How to use
44
+
45
+ Download all files from this repository to the device
46
+
47
+ ```
48
+ root@ax650:/mnt/qtang/llm-test/qwen2.5-7b# tree -L 1
49
+ .
50
+ β”œβ”€β”€ qwen2.5-7b-gptq-int4-ax650
51
+ β”œβ”€β”€ qwen2.5_tokenizer
52
+ β”œβ”€β”€ qwen2.5_tokenizer.py
53
+ β”œβ”€β”€ main_axcl_aarch64
54
+ β”œβ”€β”€ main_axcl_x86
55
+ β”œβ”€β”€ main_prefill
56
+ β”œβ”€β”€ post_config.json
57
+ β”œβ”€β”€ run_qwen2.5_7b_gptq_int4_ax650.sh
58
+ β”œβ”€β”€ run_qwen2.5_7b_gptq_int4_axcl_aarch64.sh
59
+ └── run_qwen2.5_7b_gptq_int4_axcl_x86.sh
60
+ ```
61
+
62
+ #### Start the Tokenizer service
63
+
64
+ ```
65
+ root@ax650:/mnt/qtang/llm-test/qwen2.5-7b# python qwen2.5_tokenizer.py --port 12345
66
+ None None 151645 <|im_end|>
67
+ <|im_start|>system
68
+ You are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>
69
+ <|im_start|>user
70
+ hello world<|im_end|>
71
+ <|im_start|>assistant
72
+
73
+ [151644, 8948, 198, 2610, 525, 1207, 16948, 11, 3465, 553, 54364, 14817, 13, 1446, 525, 264, 10950, 17847, 13, 151645, 198, 151644, 872, 198, 14990,
74
+ http://10.126.33.167:12345
75
+
76
+ ```
77
+
78
+ #### Inference with AX650 Host, such as M4N-Dock(爱芯派Pro) or AX650N DEMO Board
79
+
80
+ Open another terminal and run `run_qwen2.5_7b_gptq_int4_ax650.sh`
81
+
82
+ ```
83
+ root@ax650:/mnt/qtang/llm-test/qwen2.5-7b# ./run_qwen2.5_7b_gptq_int4_ax650.sh
84
+ [I][ Init][ 125]: LLM init start
85
+ bos_id: -1, eos_id: 151645
86
+ 3% | β–ˆβ–ˆ | 1 / 31 [0.00s<0.09s, 333.33 count/s] tokenizer init ok
87
+ 100% | β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ | 31 / 31 [45.25s<45.25s, 0.69 count/s] init post axmodel ok,remain_cmm(7664 MB)[I][
88
+ [I][ Init][ 246]: kv_cache_size : 512, kv_cache_num: 1024
89
+ [I][ Init][ 254]: prefill_token_num : 128
90
+ [I][ load_config][ 281]: load config:
91
+ {
92
+ "enable_repetition_penalty": false,
93
+ "enable_temperature": true,
94
+ "enable_top_k_sampling": true,
95
+ "enable_top_p_sampling": false,
96
+ "penalty_window": 20,
97
+ "repetition_penalty": 1.2,
98
+ "temperature": 0.9,
99
+ "top_k": 10,
100
+ "top_p": 0.8
101
+ }
102
+
103
+ [I][ Init][ 268]: LLM init ok
104
+ Type "q" to exit, Ctrl+c to stop current running
105
+ >> 1+1=?
106
+ [I][ Run][ 466]: ttft: 1138.88 ms
107
+ 1+1 equals 2.
108
+ [N][ Run][ 605]: hit eos,avg 4.65 token/s
109
+
110
+ >> who are you
111
+ [I][ Run][ 466]: ttft: 1137.90 ms
112
+ I'm Qwen, a large language model created by Alibaba Cloud. How can I assist you today?
113
+ [N][ Run][ 605]: hit eos,avg 4.52 token/s
114
+ ```
115
+
116
+ #### Inference with M.2 Accelerator card
117
+
118
+ [What is M.2 Accelerator card?](https://axcl-docs.readthedocs.io/zh-cn/latest/doc_guide_hardware.html), Show this DEMO based on Raspberry PI 5.
119
+
120
+ ```
121
+ (base) axera@raspberrypi:~/samples/qwen2.5-7b $ ./run_qwen2.5_7b_gptq_int4_axcl_aarch64.sh
122
+ build time: Feb 13 2025 15:15:07
123
+ [I][ Init][ 111]: LLM init start
124
+ bos_id: -1, eos_id: 151645
125
+ 100% | β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ | 31 / 31 [67.43s<67.43s, 0.46 count/s] init post axmodel okremain_cmm(2739 MB)
126
+ [I][ Init][ 226]: max_token_len : 1024
127
+ [I][ Init][ 231]: kv_cache_size : 512, kv_cache_num: 1024
128
+ [I][ load_config][ 282]: load config:
129
+ {
130
+ "enable_repetition_penalty": false,
131
+ "enable_temperature": true,
132
+ "enable_top_k_sampling": true,
133
+ "enable_top_p_sampling": false,
134
+ "penalty_window": 20,
135
+ "repetition_penalty": 1.2,
136
+ "temperature": 0.9,
137
+ "top_k": 10,
138
+ "top_p": 0.8
139
+ }
140
+
141
+ [I][ Init][ 288]: LLM init ok
142
+ Type "q" to exit, Ctrl+c to stop current running
143
+ >> who are you
144
+ I am Qwen, a large language model created by Alibaba Cloud. I'm here to help you with any questions or tasks you might have!
145
+ [N][ Run][ 610]: hit eos,avg 4.33 token/s
146
+
147
+ >> 1+1=?
148
+ 1+1 equals 2.
149
+ [N][ Run][ 610]: hit eos,avg 4.54 token/s
150
+
151
+ >> q
152
+
153
+ (base) axera@raspberrypi:~ $ axcl-smi
154
+ +------------------------------------------------------------------------------------------------+
155
+ | AXCL-SMI V2.26.0_20250206225448 Driver V2.26.0_20250206225448 |
156
+ +-----------------------------------------+--------------+---------------------------------------+
157
+ | Card Name Firmware | Bus-Id | Memory-Usage |
158
+ | Fan Temp Pwr:Usage/Cap | CPU NPU | CMM-Usage |
159
+ |=========================================+==============+=======================================|
160
+ +-----------------------------------------+--------------+---------------------------------------+
161
+ | 0 AX650N V2.26.0 | 0000:05:00.0 | 175 MiB / 945 MiB |
162
+ | -- 61C -- / -- | 0% 0% | 4301 MiB / 7040 MiB |
163
+ +-----------------------------------------+--------------+---------------------------------------+
164
+
165
+ +------------------------------------------------------------------------------------------------+
166
+ | Processes: |
167
+ | Card PID Process Name NPU Memory Usage |
168
+ |================================================================================================|
169
+ | 0 63118 /home/axera/samples/qwen2.5-7b-gptq-int4/main_axcl_aarch64 4316448 KiB |
170
+ +------------------------------------------------------------------------------------------------+
171
+
172
+ ```