Qwen2.5-VL

3周前发布 6 0 0

Qwen2.5-VL 是一个强大的多模态大语言模型,支持多种视觉和语言任务,开源免费,适合研究和开发人员使用。

语言:
zh
收录时间:
2025-04-22
Qwen2.5-VLQwen2.5-VL
Qwen2.5-VL

# Qwen2.5-VL:阿里巴巴云推出的多模态大语言模型

Qwen2.5-VL 是由阿里巴巴云 Qwen 团队开发的多模态大语言模型系列。它在前代模型的基础上进行了显著的升级,具备强大的文档解析能力、精准的对象定位能力、超长视频理解能力以及增强的智能代理功能,广泛应用于视觉与语言任务。

## 网站介绍
Qwen2.5-VL 是阿里巴巴云 Qwen 团队开发的多模态大语言模型系列。该模型在多模态理解与生成方面表现出色,具备以下关键特性:
1. **强大的文档解析能力**:支持多场景、多语言文档解析,包括手写文字、表格、图表等。
2. **精准的对象定位**:支持绝对坐标和 JSON 格式,提升空间推理能力。
3. **超长视频理解**:支持小时级视频理解,能够秒级提取事件片段。
4. **增强的智能代理功能**:在智能手机和计算机上具备更强的代理功能。

## 如何使用
### 环境准备
使用 Qwen2.5-VL 需要安装 Python 和相关依赖库。建议使用以下命令安装:
“`bash
pip install git+https://github.com/huggingface/transformers accelerate
pip install qwen-vl-utils[decord]
“`

### 示例代码
#### 使用 Hugging Face 推理
以下是使用 Qwen2.5-VL 进行文本和图像推理的示例代码:
“`python
from transformers import Qwen2_5_VLForConditionalGeneration, AutoProcessor
from qwen_vl_utils import process_vision_info

model = Qwen2_5_VLForConditionalGeneration.from_pretrained(“Qwen/Qwen2.5-VL-7B-Instruct”, device_map=”auto”)
processor = AutoProcessor.from_pretrained(“Qwen/Qwen2.5-VL-7B-Instruct”)

messages = [
{
“role”: “user”,
“content”: [
{
“type”: “image”,
“image”: “https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg”,
},
{“type”: “text”, “text”: “Describe this image.”},
],
}
]

text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
image_inputs, video_inputs = process_vision_info(messages)
inputs = processor(text=[text], images=image_inputs, videos=video_inputs, return_tensors=”pt”)
inputs = inputs.to(model.device)

generated_ids = model.generate(**inputs, max_new_tokens=128)
output_text = processor.batch_decode(generated_ids, skip_special_tokens=True)
print(output_text)
“`

#### 使用 API 推理
Qwen2.5-VL 提供了 OpenAI 兼容的 API 服务,用户可以通过以下方式调用:
“`bash
curl http://localhost:8000/v1/chat/completions \
-H “Content-Type: application/json” \
-d ‘{
“model”: “Qwen/Qwen2.5-VL-7B-Instruct”,
“messages”: [
{“role”: “system”, “content”: “You are a helpful assistant.”},
{“role”: “user”, “content”: [
{“type”: “image_url”, “image_url”: {“url”: “https://modelscope.oss-cn-beijing.aliyuncs.com/resource/qwen.png”}},
{“type”: “text”, “text”: “What is the text in the illustrate?”}
]}
]
}’
“`

## 是否收费及价格
Qwen2.5-VL 的模型和代码目前在 GitHub 上开源,用户可以免费下载和使用。然而,如果用户需要使用其 API 服务,可能需要根据使用量支付一定的费用。具体的收费细节可以参考其官方文档或联系阿里巴巴云客服。

 

数据统计

相关导航