Multimodal Models
Collection
25 items โข Updated โข 2
How to use AXERA-TECH/MiniCPM-V-4 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-text-to-text", model="AXERA-TECH/MiniCPM-V-4") # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("AXERA-TECH/MiniCPM-V-4", dtype="auto")How to use AXERA-TECH/MiniCPM-V-4 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "AXERA-TECH/MiniCPM-V-4"
# 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/MiniCPM-V-4",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/AXERA-TECH/MiniCPM-V-4
How to use AXERA-TECH/MiniCPM-V-4 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "AXERA-TECH/MiniCPM-V-4" \
--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/MiniCPM-V-4",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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/MiniCPM-V-4" \
--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/MiniCPM-V-4",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use AXERA-TECH/MiniCPM-V-4 with Docker Model Runner:
docker model run hf.co/AXERA-TECH/MiniCPM-V-4
For those who are interested in model conversion, you can try to export axmodel through the original repo : https://huggingface.co/openbmb/MiniCPM-V-4
How to Convert LLM from Huggingface to axmodel
Download all files from this repository to the device
root@ax650:~/wangjian/minicpm-v-4# tree -L 1
.
โโโ embed_tokens.pth
โโโ minicpm-v-4_axmodel
โโโ minicpmv4_tokenizer
โโโ resampler.axmodel
โโโ run_axmodel.py
โโโ show_demo.jpg
โโโ siglip.axmodel
install transformers
pip install transformers==4.51.0
run following cmd๏ผ
python3 run_axmodel.py -i show_demo.jpg -q "What is the landform in the picture?"
minicpm-v-4 output:
question1 = "What is the landform in the picture?"
answer1 = The landform in the picture is a karst topography, characterized by its unique and dramatic appearance with steep limestone cliffs rising from the water' s surface. This type of landscape is commonly found in regions with significant geological activity, such as China's Li River.
Base model
openbmb/MiniCPM-V-4