# PR #42700 完整报告

- 仓库：`vllm-project/vllm`
- 标题：[Bugfix] Replace deprecated Qwen2VLImageProcessorFast with Qwen2VLImageProcessor
- 合并时间：2026-06-13 12:04
- 原文链接：http://prhub.com.cn/vllm-project/vllm/pull/42700

---

# 执行摘要

- 一句话：修复 Qwen3VL 导入弃用类警告
- 推荐动作：可直接合并。该 PR 属于常规维护，改动微小但必要，值得快速合入以避免后续 transformers 升级时出现问题。

# 功能与动机

关闭 Issue #42688：用户报告每次加载 qwen3_vl.py 都会触发 `Qwen2VLImageProcessorFast` 弃用警告，且 transformers 未来版本可能彻底移除该别名，届时将引发 `ImportError`。PR body 明确说明：“This is not a cosmetic cleanup: the deprecated re-export is on track to be removed in a follow-up transformers release, at which point this becomes an `ImportError` rather than a warning.”

# 实现拆解

1. **修改导入语句**：将 `from transformers.models.qwen2_vl import Qwen2VLImageProcessorFast` 替换为 `from transformers.models.qwen2_vl import Qwen2VLImageProcessor`。
2. **更新类型注解**：在 `Qwen3VLProcessingInfo` 类的 `get_image_processor` 方法中，返回值类型从 `Qwen2VLImageProcessorFast` 改为 `Qwen2VLImageProcessor`。
3. **更新参数类型注解**：在 `_get_vision_info` 方法的 `image_processor` 参数类型联合中，将 `Qwen2VLImageProcessorFast` 替换为 `Qwen2VLImageProcessor`。

关键文件：
- `vllm/model_executor/models/qwen3_vl.py`（模块 模型执行器；类别 source；类型 data-contract；符号 get_image_processor）: 唯一修改文件。替换了已弃用的 `Qwen2VLImageProcessorFast` 导入和所有类型注解，共 3 处替换（+3/-3）。

关键符号：get_image_processor, _get_vision_info

## 关键源码片段

### `vllm/model_executor/models/qwen3_vl.py`

唯一修改文件。替换了已弃用的 `Qwen2VLImageProcessorFast` 导入和所有类型注解，共 3 处替换（+3/-3）。

```python
# 第 37 行：导入语句变更
# 旧：from transformers.models.qwen2_vl import Qwen2VLImageProcessorFast
# 新：使用不带 Fast 后缀的标准类名，消除 deprecation 警告
from transformers.models.qwen2_vl import Qwen2VLImageProcessor

# 第 874 行：get_image_processor 返回值类型注解变更
class Qwen3VLProcessingInfo(Qwen2VLProcessingInfo):
    def get_image_processor(self, **kwargs: object) -> Qwen2VLImageProcessor:  # 原返回类型为 Qwen2VLImageProcessorFast
        return self.get_hf_processor(**kwargs).image_processor

    # 第 894 行：_get_vision_info 参数类型注解变更
    def _get_vision_info(
        self,
        *,
        image_width: int,
        image_height: int,
        num_frames: int = 2,
        do_resize: bool = True,
        # 原类型为 Qwen2VLImageProcessorFast | Qwen3VLVideoProcessor
        image_processor: Qwen2VLImageProcessor | Qwen3VLVideoProcessor,
        mm_kwargs: Mapping[str, object],
    ) -> tuple[ImageSize, int]:
        is_video = isinstance(image_processor, Qwen3VLVideoProcessor)
        # ... 其余逻辑不变

```

# 评论区精华

维护者 DarkLight1337 批准了 PR，并评论：“Yeah this should be fine since we dropped transformers v4”，表明 vllm 已放弃对 transformers v4 的支持，因此采用新类名是安全且及时的。Issue 评论中 wangxiyuan 也催促合并，因为团队也遇到了该警告。

- 暂无高价值评论线程

# 风险与影响

- 风险：风险极低。`Qwen2VLImageProcessor` 是原 `Fast` 类的直接纯重导出（pure re-export），行为完全一致。但需确认 vllm 支持的最低 transformers 版本是否包含 `Qwen2VLImageProcessor` 符号。从 DarkLight1337 的评论“we dropped transformers v4”推断，当前依赖已跳过旧版本，因此无需担心兼容性。
- 影响：
 - **用户**：消除 deprecation 警告，提升用户体验。
 - **系统**：无运行时行为变更，仅影响导入时的日志输出。
 - **团队**：低维护成本，为未来 transformers 升级扫清障碍。
 - 风险标记：暂无

# 关联脉络

- PR #42688 [Bug]: forced to hit `Fast` suffix deprecation from `qwen3_vl` import: 此 Issue 是 PR 的直接触发原因，PR 关闭该 Issue。