Deprecated 1st generation Qwen and QwenVL models (#45131)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
@@ -13,13 +13,6 @@ CHAT_TEMPLATES_DIR = Path(__file__).parent
|
||||
ChatTemplatePath: TypeAlias = Path | Callable[[str], Path | None]
|
||||
|
||||
|
||||
def _get_qwen_chat_template_fallback(tokenizer_name_or_path: str) -> Path | None:
|
||||
if tokenizer_name_or_path.endswith("-Chat"):
|
||||
return CHAT_TEMPLATES_DIR / "template_chatml.jinja"
|
||||
|
||||
return CHAT_TEMPLATES_DIR / "template_basic.jinja"
|
||||
|
||||
|
||||
def _get_minicpmv_chat_template_fallback(tokenizer_name_or_path: str) -> Path | None:
|
||||
# MiniCPM-V-4.5 version uses a dedicated template
|
||||
if "4.5" in tokenizer_name_or_path or "4_5" in tokenizer_name_or_path:
|
||||
@@ -41,7 +34,6 @@ _MODEL_TYPE_TO_CHAT_TEMPLATE_FALLBACK: dict[str, ChatTemplatePath] = {
|
||||
"minicpmv": _get_minicpmv_chat_template_fallback,
|
||||
"minicpmv4_6": _get_minicpmv_chat_template_fallback,
|
||||
"paligemma": CHAT_TEMPLATES_DIR / "template_basic.jinja",
|
||||
"qwen": _get_qwen_chat_template_fallback,
|
||||
"siglip": CHAT_TEMPLATES_DIR / "template_basic.jinja",
|
||||
"siglip2": CHAT_TEMPLATES_DIR / "template_basic.jinja",
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ __all__ = [
|
||||
"OpenVLAProcessor",
|
||||
"OvisProcessor",
|
||||
"Ovis2_5Processor",
|
||||
"QwenVLProcessor",
|
||||
"Qwen3ASRProcessor",
|
||||
"Step3VLProcessor",
|
||||
]
|
||||
@@ -75,7 +74,6 @@ _CLASS_TO_MODULE: dict[str, str] = {
|
||||
"OpenVLAProcessor": "vllm.transformers_utils.processors.openvla",
|
||||
"OvisProcessor": "vllm.transformers_utils.processors.ovis",
|
||||
"Ovis2_5Processor": "vllm.transformers_utils.processors.ovis2_5",
|
||||
"QwenVLProcessor": "vllm.transformers_utils.processors.qwen_vl",
|
||||
"Qwen3ASRProcessor": "vllm.transformers_utils.processors.qwen3_asr",
|
||||
"Step3VLProcessor": "vllm.transformers_utils.processors.step3_vl",
|
||||
}
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
|
||||
# Adapted from
|
||||
# https://huggingface.co/Qwen/Qwen-VL/blob/main/modeling_qwen.py
|
||||
# Copyright (c) Alibaba Cloud.
|
||||
from transformers.image_processing_utils_fast import BaseImageProcessorFast
|
||||
from transformers.image_utils import PILImageResampling
|
||||
from transformers.processing_utils import ProcessorMixin
|
||||
|
||||
from vllm.tokenizers.qwen_vl import QwenVLTokenizer
|
||||
|
||||
|
||||
class QwenVLImageProcessorFast(BaseImageProcessorFast):
|
||||
"""
|
||||
Port of https://huggingface.co/Qwen/Qwen-VL/blob/main/visual.py#L354
|
||||
to HF Transformers.
|
||||
"""
|
||||
|
||||
resample = PILImageResampling.BICUBIC
|
||||
image_mean = [0.48145466, 0.4578275, 0.40821073]
|
||||
image_std = [0.26862954, 0.26130258, 0.27577711]
|
||||
size = {"height": 448, "width": 448}
|
||||
do_resize = True
|
||||
do_rescale = True
|
||||
do_normalize = True
|
||||
|
||||
|
||||
class QwenVLProcessor(ProcessorMixin):
|
||||
attributes = ["image_processor", "tokenizer"]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
image_processor: QwenVLImageProcessorFast,
|
||||
tokenizer: QwenVLTokenizer,
|
||||
) -> None:
|
||||
self.image_processor = image_processor
|
||||
self.tokenizer = tokenizer
|
||||
|
||||
self.image_start_tag = tokenizer.image_start_tag
|
||||
self.image_end_tag = tokenizer.image_end_tag
|
||||
self.image_pad_tag = tokenizer.image_pad_tag
|
||||
Reference in New Issue
Block a user