Qwen3-VL-2B-Thinking-unsloth-bnb-4bit:强大视觉语言模型,支持多模态推理与长上下文理解

Qwen系列最强大的视觉语言模型,具备卓越文本理解生成、深度视觉感知推理能力,支持长上下文、视频动态理解及多模态交互,灵活部署于边缘到云端场景。【此简介由AI生成】

分支1Tags0

tags:

  • unsloth base_model:
  • Qwen/Qwen3-VL-2B-Thinking license: apache-2.0 pipeline_tag: image-text-to-text library_name: transformers

Unsloth Dynamic 2.0 实现了卓越的准确性,性能超越其他主流量化方法。

Chat

Qwen3-VL-2B-Thinking

欢迎了解 Qwen3-VL——Qwen 系列中迄今最强大的视觉语言模型。

此代模型全面升级,包括:更优的文本理解与生成能力、更深层次的视觉感知与推理能力、更长的上下文长度、更强的空间与视频动态理解能力,以及更出色的智能体交互能力。

提供密集型(Dense)和混合专家(MoE)两种架构,可从边缘设备扩展至云端,并推出指令优化版(Instruct)和推理增强版(Thinking),满足灵活按需部署需求。

核心增强功能:

  • 视觉智能体(Visual Agent):操控电脑/手机图形用户界面——识别界面元素、理解功能、调用工具、完成任务。

  • 视觉辅助编程(Visual Coding Boost):根据图像/视频生成 Draw.io 图表及 HTML/CSS/JS 代码。

  • 高级空间感知(Advanced Spatial Perception):判断物体位置、视角和遮挡关系;提供更强的 2D 定位能力,并支持 3D 定位,助力空间推理与具身智能。

  • 长上下文与视频理解(Long Context & Video Understanding):原生支持 256K 上下文,可扩展至 100 万 tokens;能处理整本书籍和长达数小时的视频,实现完整回忆与秒级索引。

  • 增强多模态推理(Enhanced Multimodal Reasoning):在 STEM/数学领域表现出色——支持因果分析及基于证据的逻辑推理答案。

  • 升级视觉识别(Upgraded Visual Recognition):更广泛、更高质量的预训练使其能够“识别万物”——包括名人、动漫、产品、地标、动植物等。

  • 扩展 OCR 功能(Expanded OCR):支持 32 种语言(此前为 19 种);在低光、模糊、倾斜场景下表现稳健;对生僻/古文字和专业术语识别更准确;提升长文档结构解析能力。

  • 文本理解能力媲美纯语言大模型(Text Understanding on par with pure LLMs):实现无缝文本-视觉融合,达成无损统一理解。

模型架构更新:

  1. 交错式旋转位置编码(Interleaved-MRoPE):通过稳健的位置嵌入,在时间、宽度和高度维度上实现全频率分配,增强长时视频推理能力。

  2. 深度堆叠融合(DeepStack):融合多级视觉Transformer(ViT)特征,捕捉细粒度细节,提升图文对齐精度。

  3. 文本-时间戳对齐(Text–Timestamp Alignment):超越 T-RoPE,实现精确的基于时间戳的事件定位,强化视频时序建模。

本仓库为 Qwen3-VL-2B-Thinking 模型的权重仓库。


模型性能

多模态性能

纯文本性能

快速开始

以下为您提供简单示例,展示如何结合🤖 ModelScope和🤗 Transformers使用Qwen3-VL。

Qwen3-VL的代码已收录于最新版Hugging Face Transformers中,建议您通过以下命令从源码构建:

pip install git+https://github.com/huggingface/transformers
# pip install transformers==4.57.0 # currently, V4.57.0 is not released

使用 🤗 Transformers 进行对话

以下是一个代码片段,展示如何使用 transformers 调用对话模型:

from transformers import Qwen3VLForConditionalGeneration, AutoProcessor

# default: Load the model on the available device(s)
model = Qwen3VLForConditionalGeneration.from_pretrained(
    "Qwen/Qwen3-VL-2B-Thinking", dtype="auto", device_map="auto"
)

# We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.
# model = Qwen3VLForConditionalGeneration.from_pretrained(
#     "Qwen/Qwen3-VL-2B-Thinking",
#     dtype=torch.bfloat16,
#     attn_implementation="flash_attention_2",
#     device_map="auto",
# )

processor = AutoProcessor.from_pretrained("Qwen/Qwen3-VL-2B-Thinking")

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."},
        ],
    }
]

# Preparation for inference
inputs = processor.apply_chat_template(
    messages,
    tokenize=True,
    add_generation_prompt=True,
    return_dict=True,
    return_tensors="pt"
)
inputs = inputs.to(model.device)

# Inference: Generation of the output
generated_ids = model.generate(**inputs, max_new_tokens=128)
generated_ids_trimmed = [
    out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
output_text = processor.batch_decode(
    generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print(output_text)

生成超参数

VL

export greedy='false'
export top_p=0.95
export top_k=20
export repetition_penalty=1.0
export presence_penalty=0.0
export temperature=1.0
export out_seq_length=40960

文本

export greedy='false'
export top_p=0.95
export top_k=20
export repetition_penalty=1.0
export presence_penalty=1.5
export temperature=1.0
export out_seq_length=32768 (for aime, lcb, and gpqa, it is recommended to set to 81920)

引用

如果您觉得我们的工作对您有所帮助,欢迎引用我们的成果。

@misc{qwen3technicalreport,
      title={Qwen3 Technical Report}, 
      author={Qwen Team},
      year={2025},
      eprint={2505.09388},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2505.09388}, 
}

@article{Qwen2.5-VL,
  title={Qwen2.5-VL Technical Report},
  author={Bai, Shuai and Chen, Keqin and Liu, Xuejing and Wang, Jialin and Ge, Wenbin and Song, Sibo and Dang, Kai and Wang, Peng and Wang, Shijie and Tang, Jun and Zhong, Humen and Zhu, Yuanzhi and Yang, Mingkun and Li, Zhaohai and Wan, Jianqiang and Wang, Pengfei and Ding, Wei and Fu, Zheren and Xu, Yiheng and Ye, Jiabo and Zhang, Xi and Xie, Tianbao and Cheng, Zesen and Zhang, Hang and Yang, Zhibo and Xu, Haiyang and Lin, Junyang},
  journal={arXiv preprint arXiv:2502.13923},
  year={2025}
}

@article{Qwen2VL,
  title={Qwen2-VL: Enhancing Vision-Language Model's Perception of the World at Any Resolution},
  author={Wang, Peng and Bai, Shuai and Tan, Sinan and Wang, Shijie and Fan, Zhihao and Bai, Jinze and Chen, Keqin and Liu, Xuejing and Wang, Jialin and Ge, Wenbin and Fan, Yang and Dang, Kai and Du, Mengfei and Ren, Xuancheng and Men, Rui and Liu, Dayiheng and Zhou, Chang and Zhou, Jingren and Lin, Junyang},
  journal={arXiv preprint arXiv:2409.12191},
  year={2024}
}

@article{Qwen-VL,
  title={Qwen-VL: A Versatile Vision-Language Model for Understanding, Localization, Text Reading, and Beyond},
  author={Bai, Jinze and Bai, Shuai and Yang, Shusheng and Wang, Shijie and Tan, Sinan and Wang, Peng and Lin, Junyang and Zhou, Chang and Zhou, Jingren},
  journal={arXiv preprint arXiv:2308.12966},
  year={2023}
}

项目介绍

Qwen系列最强大的视觉语言模型,具备卓越文本理解生成、深度视觉感知推理能力,支持长上下文、视频动态理解及多模态交互,灵活部署于边缘到云端场景。【此简介由AI生成】

定制我的领域

下载使用量

0

项目总下载次数(含Clone、Pull、 zip 包及 release 下载),每日凌晨更新

语言类型

Jinja100%