Instructions to use Qwen/Qwen2.5-VL-72B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Qwen/Qwen2.5-VL-72B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Qwen/Qwen2.5-VL-72B-Instruct") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Qwen/Qwen2.5-VL-72B-Instruct") model = AutoModelForMultimodalLM.from_pretrained("Qwen/Qwen2.5-VL-72B-Instruct", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Qwen/Qwen2.5-VL-72B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Qwen/Qwen2.5-VL-72B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Qwen/Qwen2.5-VL-72B-Instruct", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/Qwen/Qwen2.5-VL-72B-Instruct
- SGLang
How to use Qwen/Qwen2.5-VL-72B-Instruct 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 "Qwen/Qwen2.5-VL-72B-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Qwen/Qwen2.5-VL-72B-Instruct", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "Qwen/Qwen2.5-VL-72B-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Qwen/Qwen2.5-VL-72B-Instruct", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use Qwen/Qwen2.5-VL-72B-Instruct with Docker Model Runner:
docker model run hf.co/Qwen/Qwen2.5-VL-72B-Instruct
Could you please share the detailed parameters setting for the online demo?
We have tested both the 72B pytorch and AWQ version and the precision is not as good as the online demo. We use xinference with vllm 0.7.3 and transformers 4.49.0 as the backend. We use an example image below
and the prompt below
"
输出每一笔交易的时间和金额,以json形式输出。金额要求准确,无需分隔符,以下是一个示例
##
[{"Time":YYYY-MM-DD, "Amount":0.00},{"Time":YYYY-MM-DD, "Amount":1.00}]
"
is used for both online demo and local deployment. The results are atttached below
for online demo
[
{"Time": "2019-12-08", "Amount": -113.00},
{"Time": "2019-12-08", "Amount": -183.00},
{"Time": "2019-12-18", "Amount": -7500.00},
{"Time": "2019-12-08", "Amount": -301.00},
{"Time": "2019-12-08", "Amount": -63.00},
{"Time": "2019-12-08", "Amount": -776.00},
{"Time": "2019-12-08", "Amount": -1000.00},
{"Time": "2019-12-11", "Amount": -10000.00},
{"Time": "2019-12-11", "Amount": -1486.00},
{"Time": "2019-12-11", "Amount": -596.00},
{"Time": "2019-12-12", "Amount": -1423.00},
{"Time": "2019-12-16", "Amount": -825.00},
{"Time": "2019-12-17", "Amount": -100000.00},
{"Time": "2019-12-18", "Amount": -1322.00},
{"Time": "2019-12-18", "Amount": -4400.00},
{"Time": "2019-12-21", "Amount": 1727.64},
{"Time": "2019-12-24", "Amount": -968.00}
]
and for local deployment
json
[
{"Time":"2019-12-08", "Amount":-113.00},
{"Time":"2019-12-08", "Amount":193.00},
{"Time":"2019-12-10", "Amount":-7500.00},
{"Time":"2019-12-09", "Amount":-301.00},
{"Time":"2019-12-09", "Amount":-63.00},
{"Time":"2019-12-09", "Amount":-754.00},
{"Time":"2019-12-09", "Amount":-1000.00},
{"Time":"2019-12-11", "Amount":-10000.00},
{"Time":"2019-12-11", "Amount":-1496.00},
{"Time":"2019-12-11", "Amount":-906.00},
{"Time":"2019-12-12", "Amount":-1623.00},
{"Time":"2019-12-12", "Amount":-823.00},
{"Time":"2019-12-17", "Amount":-100000.00},
{"Time":"2019-12-19", "Amount":-1322.00},
{"Time":"2019-12-19", "Amount":-4400.00},
{"Time":"2019-12-21", "Amount":1727.64},
{"Time":"2019-12-24", "Amount":-908.00}
]
It can be seen that the online demo has all the amount correct while the local deployment make mistakes e.g. line 2, 9, 10, 11, etc. It seems this is due to a different setting of some parameters such as resolution. Therefore, could you please share the setting for the online demo so that we can re-produce the results in our local deployment