Improve language tag
Browse filesHi! As the model is multilingual, this is a PR to add other languages than English to the language tag to improve the referencing. Note that 29 languages are announced in the README, but only 13 are explicitly listed. I was therefore only able to add these 13 languages.
README.md
CHANGED
@@ -1,115 +1,129 @@
|
|
1 |
-
---
|
2 |
-
base_model:
|
3 |
-
- Qwen/Qwen2.5-14B
|
4 |
-
pipeline_tag: text-generation
|
5 |
-
library_name: transformers
|
6 |
-
tags:
|
7 |
-
- rknn
|
8 |
-
- rkllm
|
9 |
-
- chat
|
10 |
-
- rk3588
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
#
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
#
|
36 |
-
|
37 |
-
|
38 |
-
#
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
ret
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
```
|
|
|
1 |
+
---
|
2 |
+
base_model:
|
3 |
+
- Qwen/Qwen2.5-14B
|
4 |
+
pipeline_tag: text-generation
|
5 |
+
library_name: transformers
|
6 |
+
tags:
|
7 |
+
- rknn
|
8 |
+
- rkllm
|
9 |
+
- chat
|
10 |
+
- rk3588
|
11 |
+
language:
|
12 |
+
- zho
|
13 |
+
- eng
|
14 |
+
- fra
|
15 |
+
- spa
|
16 |
+
- por
|
17 |
+
- deu
|
18 |
+
- ita
|
19 |
+
- rus
|
20 |
+
- jpn
|
21 |
+
- kor
|
22 |
+
- vie
|
23 |
+
- tha
|
24 |
+
- ara
|
25 |
+
---
|
26 |
+
## 3ib0n's RKLLM Guide
|
27 |
+
These models and binaries require an RK3588 board running rknpu driver version 0.9.7 or above
|
28 |
+
|
29 |
+
## Steps to reproduce conversion
|
30 |
+
```shell
|
31 |
+
# Download and setup miniforge3
|
32 |
+
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
|
33 |
+
bash Miniforge3-$(uname)-$(uname -m).sh
|
34 |
+
|
35 |
+
# activate the base environment
|
36 |
+
source ~/miniforge3/bin/activate
|
37 |
+
|
38 |
+
# create and activate a python 3.8 environment
|
39 |
+
conda create -n rknn-llm-1.1.4 python=3.8
|
40 |
+
conda activate rknn-llm-1.1.4
|
41 |
+
|
42 |
+
# clone the lastest rknn-llm toolkit
|
43 |
+
git clone https://github.com/airockchip/rknn-llm.git
|
44 |
+
|
45 |
+
# intstall dependencies for the toolkit
|
46 |
+
pip install transformers accelerate torchvision rknn-toolkit2==2.2.1
|
47 |
+
pip install --upgrade torch pillow
|
48 |
+
|
49 |
+
# install rkllm
|
50 |
+
pip install ../../rkllm-toolkit/packages/rkllm_toolkit-1.1.4-cp38-cp38-linux_x86_64.whl
|
51 |
+
|
52 |
+
# edit or create a script to export rkllm models
|
53 |
+
cd rknn-llm/examples/rkllm_multimodal_demo
|
54 |
+
nano export/export_rkllm.py # update input and output paths
|
55 |
+
python export/export_rkllm.py
|
56 |
+
```
|
57 |
+
|
58 |
+
Example export_rkllm.py modified from https://github.com/airockchip/rknn-llm/blob/main/examples/rkllm_multimodel_demo/export/export_rkllm.py
|
59 |
+
```python
|
60 |
+
import os
|
61 |
+
from rkllm.api import RKLLM
|
62 |
+
from datasets import load_dataset
|
63 |
+
from transformers import AutoTokenizer
|
64 |
+
from tqdm import tqdm
|
65 |
+
import torch
|
66 |
+
from torch import nn
|
67 |
+
|
68 |
+
modelpath = "~/models/Qwen/Qwen2.5-14B-Instruct/" ## UPDATE HERE
|
69 |
+
savepath = './Qwen2.5-14B-Instruct.rkllm' ## UPDATE HERE
|
70 |
+
llm = RKLLM()
|
71 |
+
|
72 |
+
# Load model
|
73 |
+
# Use 'export CUDA_VISIBLE_DEVICES=2' to specify GPU device
|
74 |
+
ret = llm.load_huggingface(model=modelpath, device='cpu')
|
75 |
+
if ret != 0:
|
76 |
+
print('Load model failed!')
|
77 |
+
exit(ret)
|
78 |
+
|
79 |
+
# Build model
|
80 |
+
qparams = None
|
81 |
+
|
82 |
+
## Do not use the dataset parameter as we are converting a pure text model, not a multimodal
|
83 |
+
ret = llm.build(do_quantization=True, optimization_level=1, quantized_dtype='w8a8',
|
84 |
+
quantized_algorithm='normal', target_platform='rk3588', num_npu_core=3, extra_qparams=qparams)
|
85 |
+
|
86 |
+
if ret != 0:
|
87 |
+
print('Build model failed!')
|
88 |
+
exit(ret)
|
89 |
+
|
90 |
+
# # Export rkllm model
|
91 |
+
ret = llm.export_rkllm(savepath)
|
92 |
+
if ret != 0:
|
93 |
+
print('Export model failed!')
|
94 |
+
exit(ret)
|
95 |
+
```
|
96 |
+
|
97 |
+
## Steps to build and run demo
|
98 |
+
|
99 |
+
```shell
|
100 |
+
# Dwonload the correct toolchain for working with rkllm
|
101 |
+
# Documentation here: https://github.com/airockchip/rknn-llm/blob/main/doc/Rockchip_RKLLM_SDK_EN_1.1.0.pdf
|
102 |
+
wget https://developer.arm.com/-/media/Files/downloads/gnu-a/10.2-2020.11/binrel/gcc-arm-10.2-2020.11-x86_64-aarch64-none-linux-gnu.tar.xz
|
103 |
+
tar -xz gcc-arm-10.2-2020.11-x86_64-aarch64-none-linux-gnu.tar.xz
|
104 |
+
|
105 |
+
# ensure that the gcc compiler path is set to the location where the toolchain dowloaded earlier is unpacked
|
106 |
+
nano deploy/build-linux.sh # update the gcc compiler path
|
107 |
+
|
108 |
+
# compile the demo app
|
109 |
+
cd delpoy/
|
110 |
+
./build-linux.sh
|
111 |
+
```
|
112 |
+
|
113 |
+
## Steps to run the app
|
114 |
+
More information and original guide: https://github.com/airockchip/rknn-llm/tree/main/examples/rkllm_multimodel_demo
|
115 |
+
```shell
|
116 |
+
# push install dir to device
|
117 |
+
adb push ./install/demo_Linux_aarch64 /data
|
118 |
+
# push model file to device
|
119 |
+
adb push Qwen2.5-14B-Instruct.rkllm /data/models
|
120 |
+
|
121 |
+
adb shell
|
122 |
+
cd /data/demo_Linux_aarch64
|
123 |
+
# export lib path
|
124 |
+
export LD_LIBRARY_PATH=./lib
|
125 |
+
# soft link models dir
|
126 |
+
ln -s /data/models .
|
127 |
+
# run llm(Pure Text Example)
|
128 |
+
./llm models/Qwen2.5-14B-Instruct.rkllm 128 512
|
129 |
```
|