Instructions to use Qwen/Qwen2.5-VL-72B-Instruct-AWQ 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-AWQ 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-AWQ") 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Qwen/Qwen2.5-VL-72B-Instruct-AWQ") model = AutoModelForMultimodalLM.from_pretrained("Qwen/Qwen2.5-VL-72B-Instruct-AWQ", 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Qwen/Qwen2.5-VL-72B-Instruct-AWQ 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-AWQ" # 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-AWQ", "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-AWQ
- SGLang
How to use Qwen/Qwen2.5-VL-72B-Instruct-AWQ 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-AWQ" \ --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-AWQ", "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-AWQ" \ --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-AWQ", "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-AWQ with Docker Model Runner:
docker model run hf.co/Qwen/Qwen2.5-VL-72B-Instruct-AWQ
Lanuch model with vllm --tensor-parallel (Error: input_size_per_partition not divisible by min_thread_k)
Dear all,
thank you very much for providing the quantized version! When trying to lanuch the AWQ model on a multi-GPU instance (8x16GB) with "--tensor-parallel 8 or 4 or 2" I receive an error of the following format:
Weight input_size_per_partition = 7392 is not divisible by min_thread_k = 128. Consider reducing tensor_parallel_size or running with --quantization gptq.
orWeight output_size_per_partition = 7392 is not divisible by min_thread_n = 64.
Was anyone able to launch the model on a multi-GPU instance using "--tensor-parallel" with vLLM? Currently for me it is only possible to launch the model without "--tensor-parallel" and only using "--pipeline-parallel" - here vLLM does not complain -, which of course is something different than "--tensor-parallel". Is this rather a vLLM specific issue and deploying the model using the provided transformers instructions is the way to go?
Thanks and kind regards!
Hi! When you load it, how much VRAM does it require? If it's 4-bit quant, it should something like 36 GB, right? 72B params * 4bit /1byte. Ofc, then performing inference will require more VRAM, but I just wanted to confirm the mem occupation of the loaded model
Dear all,
Please fix the intermediate model size so that it can be run on 2,4 or 8 GPUs. Thanks!
https://github.com/QwenLM/Qwen2.5-VL/issues/231
Qwen2-VL-72B-Instruct had the same issue.
Great to know! Thanks for pointing it out.
So probably we'll just wait until it was re-quantized (which was done last time) to get it working with multi-GPUs. Perfect, thanks :)
Dear all,
Please fix the intermediate model size so that it can be run on 2,4 or 8 GPUs. Thanks!
Try PointerHQ/Qwen2.5-VL-72B-Instruct-Pointer-AWQ which supports --tensor-parallel on 2, 4 and 8 GPUs.
https://huggingface.co/PointerHQ/Qwen2.5-VL-72B-Instruct-Pointer-AWQ
Dear all,
Please fix the intermediate model size so that it can be run on 2,4 or 8 GPUs. Thanks!
@Mitke15 what should be the intermediate model size in those cases? I'm receiving a similar error
The input size is not aligned with the quantized weight shape. This can be caused by too large tensor parallel size.
It happens also with the model suggested by @imjliao .
I'm trying to run the model on A100 40GB GPUs
Dear all,
Please fix the intermediate model size so that it can be run on 2,4 or 8 GPUs. Thanks!
@Mitke15 what should be the intermediate model size in those cases? I'm receiving a similar error
The input size is not aligned with the quantized weight shape. This can be caused by too large tensor parallel size.It happens also with the model suggested by @imjliao .
I'm trying to run the model on A100 40GB GPUs
Hi, I just finished uploading the updated weights, feel free to try again.
I didn't manage to get the PointerHQ version running, but it is working fine now with the official version. Thanks!