Instructions to use Qwen/Qwen-VL-Chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Qwen/Qwen-VL-Chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Qwen/Qwen-VL-Chat", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-VL-Chat", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Qwen/Qwen-VL-Chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Qwen/Qwen-VL-Chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Qwen/Qwen-VL-Chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Qwen/Qwen-VL-Chat
- SGLang
How to use Qwen/Qwen-VL-Chat 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/Qwen-VL-Chat" \ --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": "Qwen/Qwen-VL-Chat", "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 "Qwen/Qwen-VL-Chat" \ --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": "Qwen/Qwen-VL-Chat", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Qwen/Qwen-VL-Chat with Docker Model Runner:
docker model run hf.co/Qwen/Qwen-VL-Chat
VL-Chat测试中学物理试卷识别胡说八道
请问, 有人使用过这个模型做过图片的内容识别和推理么, 我用这个版本测试了一页初中物理试卷, 内容识别完全是胡说八道啊. 我招的demo做的, 唯一就是把query 换成 text: “图片22题讲了什么内容.” 模型输出的内容和图片完全没有关系.
VL模型先完成文字识别,然后再调用LLM生成答案。Qwen-vl 中文识别能力不错,但这么小的模型显然不可能有很强的数学和推理能力。你可以试试他们的Qwen-VL-Max, 但这个模型不开源的。
VL模型先完成文字识别,然后再调用LLM生成答案。Qwen-vl 中文识别能力不错,但这么小的模型显然不可能有很强的数学和推理能力。你可以试试他们的Qwen-VL-Max, 但这个模型不开源的。
我使用的query“图片22题讲了什么内容.” 目的就是希望VL模型把识别的内容整理出来, 但是它回复的和试卷上的文字一点关系都没有,我不是让它做题,我也知道它做不了题。 是我的prompt不对么, 你有什么好的建议么,如何让开源的VL识别出文字并输出?
我测试过这个模型的OCR能力。我的提示词是“请识别图上的文字,不要加任何解读和评论。”同时,把temperature 的值调低一点,我设置成了0.2
我测试过这个模型的OCR能力。我的提示词是“请识别图上的文字,不要加任何解读和评论。”同时,把temperature 的值调低一点,我设置成了0.2
好的, 非常感谢,我试一下.
按照你的prompt测试了一下,还是不能获取图片里面完整的文本内容。我感觉这个VL-CHAT主要作用就是看这个图片大概是什么, 涉及到里面的文字,大部分都识别不对,是我使用姿势不对么?