3ib0n commited on
Commit
34c9ca7
·
verified ·
1 Parent(s): cc4b831

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,9 @@ 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
+ Qwen2-VL-7B-Instruct.rkllm filter=lfs diff=lfs merge=lfs -text
37
+ demo_Linux_aarch64/demo filter=lfs diff=lfs merge=lfs -text
38
+ demo_Linux_aarch64/imgenc filter=lfs diff=lfs merge=lfs -text
39
+ demo_Linux_aarch64/lib/librkllmrt.so filter=lfs diff=lfs merge=lfs -text
40
+ demo_Linux_aarch64/lib/librknnrt.so filter=lfs diff=lfs merge=lfs -text
41
+ qwen2_vl_7b_vision_rk3588.rknn filter=lfs diff=lfs merge=lfs -text
Qwen2-VL-7B-Instruct.rkllm ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a8e4d0ff584bfc1ac9d16d4e17c8c2543a517c3386d0c661d3ad2c691d55695
3
+ size 8193645220
README.md ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model:
3
+ - Qwen/Qwen2-VL-7B
4
+ pipeline_tag: image-text-to-text
5
+ library_name: transformers
6
+ tags:
7
+ - rknn
8
+ - rkllm
9
+ - chat
10
+ - vision
11
+ - rk3588
12
+ - multimodal
13
+ ---
14
+ ## 3ib0n's RKLLM Guide
15
+ These models and binaries require an RK3588 board running rknpu driver version 0.9.7 or above
16
+
17
+ ## Steps to reproduce conversion
18
+ ```shell
19
+ # Download and setup miniforge3
20
+ curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
21
+ bash Miniforge3-$(uname)-$(uname -m).sh
22
+
23
+ # activate the base environment
24
+ source ~/miniforge3/bin/activate
25
+
26
+ # create and activate a python 3.8 environment
27
+ conda create -n rknn-llm-1.1.4 python=3.8
28
+ conda activate rknn-llm-1.1.4
29
+
30
+ # clone the lastest rknn-llm toolkit
31
+ git clone https://github.com/airockchip/rknn-llm.git
32
+
33
+ # update the following 4 files to your desired models and output locations
34
+ cd rknn-llm/examples/rkllm_multimodal_demo
35
+ nano export/export_vision.py # update model path and output path
36
+ nano export/export_vision_rknn.py # update model path
37
+ nano export/export_rkllm.py # update input and output paths
38
+ nano data/make_input_embeds_for_quantize.py # update model path
39
+
40
+ # intstall necessary dependencies for the above
41
+ pip install transformers accelerate torchvision rknn-toolkit2==2.2.1
42
+ pip install --upgrade torch pillow # necessary to use vision models with opset_version=18
43
+
44
+ # export vision models and create input embeddings
45
+ cd export/
46
+ python export_vision.py
47
+ python export_vision_rknn.py
48
+ cd ..
49
+ python data/make_input_embeds_for_quantize.py
50
+
51
+ # install rkllm and export the language model
52
+ pip install ../../rkllm-toolkit/packages/rkllm_toolkit-1.1.4-cp38-cp38-linux_x86_64.whl
53
+ python export/export_rkllm.py
54
+ ```
55
+
56
+ ## Steps to build and run demo
57
+
58
+ ```shell
59
+ # Dwonload the correct toolchain for working with rkllm
60
+ # Documentation here: https://github.com/airockchip/rknn-llm/blob/main/doc/Rockchip_RKLLM_SDK_EN_1.1.0.pdf
61
+ 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
62
+ tar -xz gcc-arm-10.2-2020.11-x86_64-aarch64-none-linux-gnu.tar.xz
63
+
64
+ # ensure that the gcc compiler path is set to the location where the toolchain dowloaded earlier is unpacked
65
+ nano deploy/build-linux.sh # update the gcc compiler path
66
+
67
+ # compile the demo app
68
+ cd delpoy/
69
+ ./build-linux.sh
70
+ ```
71
+
72
+ ## Steps to run the app
73
+ More information and original guide: https://github.com/airockchip/rknn-llm/tree/main/examples/rkllm_multimodel_demo
74
+ ```shell
75
+ # push install dir to device
76
+ adb push ./install/demo_Linux_aarch64 /data
77
+ # push model file to device
78
+ adb push qwen2_vl_7b_vision_rk3588.rknn /data/models
79
+ adb push Qwen2-VL-7B-Instruct.rkllm /data/models
80
+ # push demo image to device
81
+ adb push ../data/demo.jpg /data/demo_Linux_aarch64
82
+
83
+ adb shell
84
+ cd /data/demo_Linux_aarch64
85
+ # export lib path
86
+ export LD_LIBRARY_PATH=./lib
87
+ # soft link models dir
88
+ ln -s /data/models .
89
+ # run imgenc
90
+ ./imgenc models/qwen2_vl_7b_vision_rk3588.rknn demo.jpg
91
+ # run llm(Pure Text Example)
92
+ ./llm models/Qwen2-VL-7B-Instruct.rkllm 128 512
93
+ # run demo(Multimodal Example)
94
+ ./demo demo.jpg models/qwen2_vl_7b_vision_rk3588.rknn models/Qwen2-VL-7B-Instruct.rkllm 128 512
95
+ ```
demo_Linux_aarch64/demo ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7141948b3a63038d86efee9c4a81d60ce21cfdacbae4c7964169c9277a18755b
3
+ size 6853536
demo_Linux_aarch64/demo.jpg ADDED
demo_Linux_aarch64/imgenc ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8264cfe228be63b2a1e0f66a5ed39d6405354d7342a71d76beb3e1c7ab04bab6
3
+ size 6857520
demo_Linux_aarch64/lib/librkllmrt.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3cef353105c3bfd31f99c4963fce8498d2fac633d845633c904f523b7c3bcd0a
3
+ size 6239192
demo_Linux_aarch64/lib/librknnrt.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1170e5f99f2db7ed4d3a4c2bdbed941b7363bd090e0c28b4e210f40614327911
3
+ size 7192616
demo_Linux_aarch64/llm ADDED
Binary file (30.3 kB). View file
 
demo_Linux_aarch64/llm_test ADDED
Binary file (20.3 kB). View file
 
qwen2_vl_7b_vision.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:62db3dee5289e6fd4ac1a3098155a26a51dfe055f2ece054ebb3cf8b0d19b84b
3
+ size 1196568
qwen2_vl_7b_vision_rk3588.rknn ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f2defafdf6757a7bf00fdca26972d2df1dc23f8ba9a8bacd953af7424b885b0a
3
+ size 1411993850