-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e19dab9
commit 4648334
Showing
14 changed files
with
741 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ python3 export_onnx.py --model_path your_minicpmv_path | |
此处介绍如何将onnx模型编译成bmodel。也可以省去编译模型这一步,直接下载编译好的模型: | ||
|
||
``` shell | ||
python3 -m dfss [email protected]:/ext_model_information/LLM/LLM-TPU/minicpmv26_bm1684x_int4.bmodel | ||
python3 -m dfss [email protected]:/ext_model_information/LLM/LLM-TPU/minicpmv26_bm1684x_int4_seq1024.bmodel | ||
``` | ||
|
||
#### 1. 下载docker,启动容器 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,18 @@ | |
## Export onnx | ||
|
||
```shell | ||
pip install transformers_stream_generator einops tiktoken accelerate torch==2.0.1+cpu torchvision==0.15.2 transformers==4.40.0 | ||
pip install torch==2.5.1 --index-url https://download.pytorch.org/whl/cpu | ||
pip install transformers_stream_generator einops tiktoken accelerate transformers==4.40.0 | ||
cp files/MiniCPM-V-2_6/modeling_qwen2.py /usr/local/lib/python3.10/dist-packages/transformers/models/qwen2/ | ||
cp files/MiniCPM-V-2_6/resampler.py your_torch_model | ||
cp files/MiniCPM-V-2_6/modeling_navit_siglip.py your_torch_model | ||
``` | ||
your_torch_model是你模型的位置 | ||
```shell | ||
python3 export_onnx.py --model_path your_torch_model --seq_length 512 --device cpu | ||
python3 export_onnx.py --model_path your_torch_model --seq_length 512 --device cpu --image_file ../python_demo/test0.jpg | ||
``` | ||
* image_file:image_file为真实图片的路径,导出模型时,输入size会固定为该图片的size。`image_file请输入你实际的图片` | ||
* 目前不支持多图,不支持图片size可变 | ||
|
||
## Compile bmodel | ||
使用io_alone | ||
|
@@ -23,7 +26,7 @@ python3 export_onnx.py --model_path your_torch_model --seq_length 512 --device c | |
也可以直接下载编译好的模型,不用自己编译 | ||
```shell | ||
pip3 install dfss | ||
python3 -m dfss [email protected]:/ext_model_information/LLM/LLM-TPU/minicpm_int4_seq512_1dev.bmodel | ||
python3 -m dfss [email protected]:/ext_model_information/LLM/LLM-TPU/minicpmv26_bm1684x_int4_seq1024.bmodel | ||
``` | ||
|
||
### python demo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ pip3 install gradio==3.39.0 mdtex2html==1.2.0 dfss | |
|
||
如果不打算自己编译模型,可以直接用下载好的模型 | ||
``` | ||
python3 -m dfss [email protected]:/ext_model_information/LLM/LLM-TPU/minicpmv26_bm1684x_int4.bmodel | ||
python3 -m dfss [email protected]:/ext_model_information/LLM/LLM-TPU/minicpmv26_bm1684x_int4_seq1024.bmodel | ||
``` | ||
|
||
编译库文件 | ||
|
@@ -20,5 +20,5 @@ cd build && cmake .. && make && cp *cpython* .. && cd .. | |
|
||
# python demo | ||
``` | ||
python3 pipeline.py --model_path minicpmv26_bm1684x_int4.bmodel --tokenizer_path ../support/token_config/ --devid 0 | ||
``` | ||
python3 pipeline.py --model_path minicpmv26_bm1684x_int4_seq1024.bmodel --processor_path ../support/processor_config/ --devid 0 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.