qqc1989 commited on
Commit
bbdd992
·
verified ·
1 Parent(s): 3756ca8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +173 -3
README.md CHANGED
@@ -1,3 +1,173 @@
1
- ---
2
- license: bsd-3-clause
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ license: bsd-3-clause
4
+ base_model:
5
+ - Qwen/Qwen2.5-3B-Instruct-GPTQ-Int4
6
+ tags:
7
+ - Qwen
8
+ - Qwen2.5-3B-Instruct
9
+ - Qwen2.5-3B-Instruct-GPTQ-Int4
10
+ - GPTQ
11
+ - Int4
12
+ ---
13
+
14
+ # Qwen2.5-1.5B-Instruct-GPTQ-Int4
15
+
16
+ This version of Qwen2.5-3B-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-3B-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| 5 tokens/sec|10 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-3b# tree -L 1
49
+ .
50
+ ├── qwen2.5-3b-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_3b_gptq_int4_ax650.sh
58
+ ├── run_qwen2.5_3b_gptq_int4_axcl_aarch64.sh
59
+ └── run_qwen2.5_3b_gptq_int4_axcl_x86.sh
60
+ ```
61
+
62
+ #### Start the Tokenizer service
63
+
64
+ ```
65
+ root@ax650:/mnt/qtang/llm-test/qwen2.5-3b# 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, 1879 , 151645, 198, 151644, 77091, 198]
74
+ http://localhost:12345
75
+ ```
76
+
77
+ #### Inference with AX650 Host, such as M4N-Dock(爱芯派Pro) or AX650N DEMO Board
78
+
79
+ Open another terminal and run `run_qwen2.5_1.5b_gptq_int4_ax650.sh`
80
+
81
+ ```
82
+ root@ax650:/mnt/qtang/llm-test/qwen2.5-1.5b# ./run_qwen2.5_3b_gptq_int4_ax650.sh
83
+ [I][ Init][ 125]: LLM init start
84
+ [I][ Init][ 26]: LLaMaEmbedSelector use mmap
85
+ 100% | ████████████████████████████████ | 39 / 39 [19.30s<19.30s, 2.02 count/s] init post axmodel ok,remain_cmm(1811 MB)
86
+ [I][ Init][ 241]: max_token_len : 1024
87
+ [I][ Init][ 246]: kv_cache_size : 256, kv_cache_num: 1024
88
+ [I][ Init][ 254]: prefill_token_num : 128
89
+ [I][ load_config][ 281]: load config:
90
+ {
91
+ "enable_repetition_penalty": false,
92
+ "enable_temperature": true,
93
+ "enable_top_k_sampling": true,
94
+ "enable_top_p_sampling": false,
95
+ "penalty_window": 20,
96
+ "repetition_penalty": 1.2,
97
+ "temperature": 0.9,
98
+ "top_k": 10,
99
+ "top_p": 0.8
100
+ }
101
+
102
+ [I][ Init][ 268]: LLM init ok
103
+ Type "q" to exit, Ctrl+c to stop current running
104
+
105
+ >> who are you
106
+ [I][ Run][ 466]: ttft: 545.11 ms
107
+ I am Qwen, an artificial intelligence from Alibaba Cloud. I am here to assist you with any information or tasks you might have. How can I assist you today?
108
+
109
+ [N][ Run][ 605]: hit eos,avg 9.90 token/s
110
+
111
+ >> 1+1=?
112
+ [I][ Run][ 466]: ttft: 545.63 ms
113
+ 1+1 equals 2.
114
+
115
+ [N][ Run][ 605]: hit eos,avg 9.85 token/s
116
+ ```
117
+
118
+ #### Inference with M.2 Accelerator card
119
+
120
+ [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.
121
+
122
+ ```
123
+ (base) axera@raspberrypi:~/samples/qwen2.5-3b $ ./run_qwen2.5_3b_gptq_int4_axcl_aarch64.sh
124
+ build time: Feb 13 2025 15:44:57
125
+ [I][ Init][ 111]: LLM init start
126
+ 100% | ████████████████████████████████ | 39 / 39 [37.95s<37.95s, 1.03 count/s] init post axmodel ok remain_cmm(5391 MB)
127
+ [I][ Init][ 226]: max_token_len : 1024
128
+ [I][ Init][ 231]: kv_cache_size : 256, kv_cache_num: 1024
129
+ [I][ load_config][ 282]: load config:
130
+ {
131
+ "enable_repetition_penalty": false,
132
+ "enable_temperature": true,
133
+ "enable_top_k_sampling": true,
134
+ "enable_top_p_sampling": false,
135
+ "penalty_window": 20,
136
+ "repetition_penalty": 1.2,
137
+ "temperature": 0.9,
138
+ "top_k": 10,
139
+ "top_p": 0.8
140
+ }
141
+
142
+ [I][ Init][ 288]: LLM init ok
143
+ Type "q" to exit, Ctrl+c to stop current running
144
+ >> who are you
145
+ I am Qwen, an artificial intelligence from Alibaba Cloud. I am here to assist you with your questions and help in any way I can. How can I assist you today?
146
+
147
+ [N][ Run][ 610]: hit eos,avg 8.23 token/s
148
+
149
+ >> 1+1=?
150
+ 1+1=2
151
+
152
+ [N][ Run][ 610]: hit eos,avg 8.72 token/s
153
+
154
+ >> q
155
+
156
+ (base) axera@raspberrypi:~ $ axcl-smi
157
+ +------------------------------------------------------------------------------------------------+
158
+ | AXCL-SMI V2.26.0_20250205130139 Driver V2.26.0_20250205130139 |
159
+ +-----------------------------------------+--------------+---------------------------------------+
160
+ | Card Name Firmware | Bus-Id | Memory-Usage |
161
+ | Fan Temp Pwr:Usage/Cap | CPU NPU | CMM-Usage |
162
+ |=========================================+==============+=======================================|
163
+ | 0 AX650N V2.26.0 | 0000:01:00.0 | 174 MiB / 945 MiB |
164
+ | -- 43C -- / -- | 0% 0% | 1973 MiB / 7040 MiB |
165
+ +-----------------------------------------+--------------+---------------------------------------+
166
+
167
+ +------------------------------------------------------------------------------------------------+
168
+ | Processes: |
169
+ | Card PID Process Name NPU Memory Usage |
170
+ |================================================================================================|
171
+ | 0 470413 /home/axera/samples/qwen2.5-3b-gptq-int4/main_axcl_aarch64 1963704 KiB |
172
+ +------------------------------------------------------------------------------------------------+
173
+ ```