Instructions to use AXERA-TECH/InternVL2_5-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AXERA-TECH/InternVL2_5-1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="AXERA-TECH/InternVL2_5-1B")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("AXERA-TECH/InternVL2_5-1B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AXERA-TECH/InternVL2_5-1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AXERA-TECH/InternVL2_5-1B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AXERA-TECH/InternVL2_5-1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/AXERA-TECH/InternVL2_5-1B
- SGLang
How to use AXERA-TECH/InternVL2_5-1B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "AXERA-TECH/InternVL2_5-1B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AXERA-TECH/InternVL2_5-1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "AXERA-TECH/InternVL2_5-1B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AXERA-TECH/InternVL2_5-1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use AXERA-TECH/InternVL2_5-1B with Docker Model Runner:
docker model run hf.co/AXERA-TECH/InternVL2_5-1B
Update README.md
Browse files
README.md
CHANGED
|
@@ -3,9 +3,11 @@ library_name: transformers
|
|
| 3 |
license: bsd-3-clause
|
| 4 |
base_model:
|
| 5 |
- OpenGVLab/InternVL2_5-1B
|
|
|
|
| 6 |
tags:
|
| 7 |
- InternVL2_5
|
| 8 |
- InternVL2_5-1B
|
|
|
|
| 9 |
- Int8
|
| 10 |
- VLM
|
| 11 |
---
|
|
@@ -36,16 +38,24 @@ https://huggingface.co/OpenGVLab/InternVL2_5-1B
|
|
| 36 |
- [M4N-Dock(η±θ―ζ΄ΎPro)](https://wiki.sipeed.com/hardware/zh/maixIV/m4ndock/m4ndock.html)
|
| 37 |
- [M.2 Accelerator card](https://axcl-docs.readthedocs.io/zh-cn/latest/doc_guide_hardware.html)
|
| 38 |
- AX630C
|
| 39 |
-
-
|
|
|
|
|
|
|
| 40 |
|
| 41 |
|Chips|image encoder 448|ttft|w8a16|
|
| 42 |
|--|--|--|--|
|
| 43 |
|AX650| 350 ms | 420 ms |32 tokens/sec|
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
## How to use
|
| 46 |
|
| 47 |
Download all files from this repository to the device
|
| 48 |
|
|
|
|
| 49 |
```
|
| 50 |
root@ax650:/mnt/qtang/llm-test/temp/InternVL2_5-1B# tree -L 1
|
| 51 |
.
|
|
@@ -58,6 +68,18 @@ root@ax650:/mnt/qtang/llm-test/temp/InternVL2_5-1B# tree -L 1
|
|
| 58 |
`-- ssd_car.jpg
|
| 59 |
```
|
| 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
#### Install transformer
|
| 62 |
|
| 63 |
```
|
|
@@ -66,6 +88,7 @@ pip install transformers==4.41.1
|
|
| 66 |
|
| 67 |
#### Start the Tokenizer service
|
| 68 |
|
|
|
|
| 69 |
```
|
| 70 |
root@ax650:/mnt/qtang/llm-test/temp/InternVL2_5-1B# python3 internvl2_5_tokenizer_448.py --port 12345
|
| 71 |
None None 151645 <|im_end|>
|
|
@@ -85,6 +108,25 @@ None None 151645 <|im_end|>
|
|
| 85 |
http://localhost:12345
|
| 86 |
```
|
| 87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
#### Inference with AX650 Host, such as M4N-Dock(η±θ―ζ΄ΎPro) or AX650N DEMO Board
|
| 89 |
|
| 90 |
- input text
|
|
@@ -105,7 +147,7 @@ root@ax650:/mnt/qtang/llm-test/temp/InternVL2_5-1B# ./run_internvl2_5_448_ax650.
|
|
| 105 |
bos_id: -1, eos_id: 151645
|
| 106 |
3% | ββ | 1 / 28 [0.01s<0.14s, 200.00 count/s] tokenizer init ok
|
| 107 |
[I][ Init][ 26]: LLaMaEmbedSelector use mmap
|
| 108 |
-
100% | ββββββββββββββββββββββββββββββββ | 28 / 28 [1.42s<1.42s, 19.66 count/s] init vpm axmodel ok,remain_cmm(2859 MB)
|
| 109 |
[I][ Init][ 275]: max_token_len : 1023
|
| 110 |
[I][ Init][ 280]: kv_cache_size : 128, kv_cache_num: 1023
|
| 111 |
[I][ Init][ 288]: prefill_token_num : 320
|
|
@@ -134,4 +176,45 @@ root@ax650:/mnt/qtang/llm-test/temp/InternVL2_5-1B#
|
|
| 134 |
|
| 135 |
[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.
|
| 136 |
|
| 137 |
-
*TODO*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
license: bsd-3-clause
|
| 4 |
base_model:
|
| 5 |
- OpenGVLab/InternVL2_5-1B
|
| 6 |
+
- OpenGVLab/InternVL2_5-1B-MPO
|
| 7 |
tags:
|
| 8 |
- InternVL2_5
|
| 9 |
- InternVL2_5-1B
|
| 10 |
+
- InternVL2_5-1B-MPO
|
| 11 |
- Int8
|
| 12 |
- VLM
|
| 13 |
---
|
|
|
|
| 38 |
- [M4N-Dock(η±θ―ζ΄ΎPro)](https://wiki.sipeed.com/hardware/zh/maixIV/m4ndock/m4ndock.html)
|
| 39 |
- [M.2 Accelerator card](https://axcl-docs.readthedocs.io/zh-cn/latest/doc_guide_hardware.html)
|
| 40 |
- AX630C
|
| 41 |
+
- [η±θ―ζ΄Ύ2](https://axera-pi-2-docs-cn.readthedocs.io/zh-cn/latest/index.html)
|
| 42 |
+
- [Module-LLM](https://docs.m5stack.com/zh_CN/module/Module-LLM)
|
| 43 |
+
- [LLM630 Compute Kit](https://docs.m5stack.com/zh_CN/core/LLM630%20Compute%20Kit)
|
| 44 |
|
| 45 |
|Chips|image encoder 448|ttft|w8a16|
|
| 46 |
|--|--|--|--|
|
| 47 |
|AX650| 350 ms | 420 ms |32 tokens/sec|
|
| 48 |
|
| 49 |
+
|Chips|image encoder 364|ttft|w8a16|
|
| 50 |
+
|--|--|--|--|
|
| 51 |
+
|AX63C| 350 ms | 1100 ms |11 tokens/sec|
|
| 52 |
+
|
| 53 |
+
|
| 54 |
## How to use
|
| 55 |
|
| 56 |
Download all files from this repository to the device
|
| 57 |
|
| 58 |
+
**If you using AX650 Board**
|
| 59 |
```
|
| 60 |
root@ax650:/mnt/qtang/llm-test/temp/InternVL2_5-1B# tree -L 1
|
| 61 |
.
|
|
|
|
| 68 |
`-- ssd_car.jpg
|
| 69 |
```
|
| 70 |
|
| 71 |
+
**If you using AX630C Board**
|
| 72 |
+
```
|
| 73 |
+
root@ax630c:/mnt/qtang/llm-test/internvl2_5-1b-mpo# tree -L 1
|
| 74 |
+
.
|
| 75 |
+
|-- config.json
|
| 76 |
+
|-- internvl2_5_1b_364_ax630c
|
| 77 |
+
|-- internvl2_5_tokenizer
|
| 78 |
+
|-- internvl2_5_tokenizer_364.py
|
| 79 |
+
|-- main
|
| 80 |
+
`-- run_internvl2_5_364_ax630c.sh
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
#### Install transformer
|
| 84 |
|
| 85 |
```
|
|
|
|
| 88 |
|
| 89 |
#### Start the Tokenizer service
|
| 90 |
|
| 91 |
+
**If you using AX650 Board**
|
| 92 |
```
|
| 93 |
root@ax650:/mnt/qtang/llm-test/temp/InternVL2_5-1B# python3 internvl2_5_tokenizer_448.py --port 12345
|
| 94 |
None None 151645 <|im_end|>
|
|
|
|
| 108 |
http://localhost:12345
|
| 109 |
```
|
| 110 |
|
| 111 |
+
**If you using AX630C Board**
|
| 112 |
+
```
|
| 113 |
+
root@ax650:/mnt/qtang/llm-test/temp/InternVL2_5-1B# python internvl2_5_tokenizer_364.py --port 12345
|
| 114 |
+
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
|
| 115 |
+
None None 151645 <|im_end|>
|
| 116 |
+
[151644, 8948, 198, 56568, 104625, 100633, 104455, 104800, 101101, 32022, 102022, 99602, 100013, 9370, 90286, 21287,
|
| 117 |
+
42140, 53772, 35243, 26288, 104949, 3837, 105205, 109641, 67916, 30698, 11, 54851, 46944, 115404, 42192, 99441, 100623,
|
| 118 |
+
48692, 100168, 110498, 1773, 151645, 151644, 872, 198, 151665, 151667, 151667, 151667, 151667, 151667, 151667, 151667,
|
| 119 |
+
......
|
| 120 |
+
151667, 151667, 151667, 151667, 151667, 151667, 151667, 151667, 151667, 151667, 151667, 151667, 151666, 198, 5501, 7512,
|
| 121 |
+
279, 2168, 19620, 13, 151645, 151644, 77091, 198]
|
| 122 |
+
223
|
| 123 |
+
[151644, 8948, 198, 56568, 104625, 100633, 104455, 104800, 101101, 32022, 102022, 99602, 100013, 9370, 90286, 21287, 42140,
|
| 124 |
+
53772, 35243, 26288, 104949, 3837, 105205, 109641, 67916, 30698, 11, 54851, 46944, 115404, 42192, 99441, 100623, 48692,
|
| 125 |
+
100168, 110498, 1773, 151645, 151644, 872, 198, 14990, 1879, 151645, 151644, 77091, 198]
|
| 126 |
+
47
|
| 127 |
+
http://localhost:12345
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
#### Inference with AX650 Host, such as M4N-Dock(η±θ―ζ΄ΎPro) or AX650N DEMO Board
|
| 131 |
|
| 132 |
- input text
|
|
|
|
| 147 |
bos_id: -1, eos_id: 151645
|
| 148 |
3% | ββ | 1 / 28 [0.01s<0.14s, 200.00 count/s] tokenizer init ok
|
| 149 |
[I][ Init][ 26]: LLaMaEmbedSelector use mmap
|
| 150 |
+
100% | ββββββββββββββββββββββββββββββββ | 28 / 28 [1.42s<1.42s, 19.66 count/s] init vpm axmodel ok,remain_cmm(2859 MB)
|
| 151 |
[I][ Init][ 275]: max_token_len : 1023
|
| 152 |
[I][ Init][ 280]: kv_cache_size : 128, kv_cache_num: 1023
|
| 153 |
[I][ Init][ 288]: prefill_token_num : 320
|
|
|
|
| 176 |
|
| 177 |
[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.
|
| 178 |
|
| 179 |
+
*TODO*
|
| 180 |
+
|
| 181 |
+
#### Inference with AX630C Host, such as η±θ―ζ΄Ύ2, Module-LLM, LLM630 Compute Kit and AX630C DEMO Board
|
| 182 |
+
|
| 183 |
+
- input text
|
| 184 |
+
|
| 185 |
+
```
|
| 186 |
+
Describe the picture
|
| 187 |
+
```
|
| 188 |
+
|
| 189 |
+
- input image
|
| 190 |
+
|
| 191 |
+

|
| 192 |
+
|
| 193 |
+
Open another terminal and run `./run_internvl2_5_364_ax630c.sh`
|
| 194 |
+
|
| 195 |
+
```
|
| 196 |
+
/mnt/qtang/llm-test/internvl2_5-1b-mpo # ./run_internvl2_5_364_ax630c.sh
|
| 197 |
+
[I][ Init][ 106]: LLM init start
|
| 198 |
+
bos_id: -1, eos_id: 151645
|
| 199 |
+
3% | ββ | 1 / 28 [0.01s<0.14s, 200.00 count/s] tokenizer init ok
|
| 200 |
+
[I][ Init][ 26]: LLaMaEmbedSelector use mmap
|
| 201 |
+
100% | ββββββββββββββββββββββββββββββββ | 28 / 28 [9.48s<9.48s, 2.95 count/s] init vpm axmodel ok,remain_cmm(905 MB)
|
| 202 |
+
[I][ Init][ 254]: max_token_len : 1023
|
| 203 |
+
[I][ Init][ 259]: kv_cache_size : 128, kv_cache_num: 1023
|
| 204 |
+
[I][ Init][ 267]: prefill_token_num : 256
|
| 205 |
+
[I][ Init][ 269]: vpm_height : 364,vpm_width : 364
|
| 206 |
+
[I][ Init][ 278]: LLM init ok
|
| 207 |
+
Type "q" to exit, Ctrl+c to stop current running
|
| 208 |
+
|
| 209 |
+
prompt >> Please describe the image
|
| 210 |
+
image >> panda.jpg
|
| 211 |
+
[I][ Encode][ 337]: image encode time : 1156.637939 ms, size : 151424
|
| 212 |
+
[I][ Run][ 548]: ttft: 1120.15 ms
|
| 213 |
+
|
| 214 |
+
The image features a red panda in a natural setting, likely in a zoo or a forested area.
|
| 215 |
+
The red panda has distinctive reddish-brown fur with white markings around its eyes and ears.
|
| 216 |
+
It is leaning on a wooden structure, possibly a platform or a log, with a background of green foliage.
|
| 217 |
+
The red panda appears to be looking directly at the camera with a calm expression.
|
| 218 |
+
|
| 219 |
+
[N][ Run][ 687]: hit eos,avg 10.94 token/s
|
| 220 |
+
```
|