3ib0n commited on
Commit
9ca46b6
·
verified ·
1 Parent(s): 2bc54a4

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