3333import torch .nn .functional as F
3434from einops import rearrange
3535from transformers import BatchFeature
36- from transformers .models .qwen2_5_vl import (Qwen2_5_VLImageProcessor ,
37- Qwen2_5_VLProcessor )
36+ from transformers .models .qwen2_5_vl import Qwen2_5_VLProcessor
3837from transformers .models .qwen2_5_vl .configuration_qwen2_5_vl import (
3938 Qwen2_5_VLConfig , Qwen2_5_VLVisionConfig )
39+ from transformers .models .qwen2_vl import (Qwen2VLImageProcessor ,
40+ Qwen2VLImageProcessorFast )
4041
4142from vllm .attention import AttentionMetadata
4243from vllm .config import VllmConfig
@@ -693,7 +694,8 @@ def get_hf_processor(
693694 ) -> Qwen2_5_VLProcessor :
694695 hf_processor = self .ctx .get_hf_processor (Qwen2_5_VLProcessor )
695696 image_processor = hf_processor .image_processor # type: ignore
696- assert isinstance (image_processor , Qwen2_5_VLImageProcessor )
697+ assert isinstance (image_processor ,
698+ (Qwen2VLImageProcessor , Qwen2VLImageProcessorFast ))
697699
698700 if min_pixels :
699701 image_processor .min_pixels = min_pixels
@@ -713,14 +715,15 @@ def get_image_processor(
713715 min_pixels : Optional [int ] = None ,
714716 max_pixels : Optional [int ] = None ,
715717 fps : Optional [float ] = 2.0 ,
716- ) -> Qwen2_5_VLImageProcessor :
718+ ) -> Union [ Qwen2VLImageProcessor , Qwen2VLImageProcessorFast ] :
717719 hf_processor = self .get_hf_processor (
718720 min_pixels = min_pixels ,
719721 max_pixels = max_pixels ,
720722 fps = fps ,
721723 )
722724 image_processor = hf_processor .image_processor # type: ignore
723- assert isinstance (image_processor , Qwen2_5_VLImageProcessor )
725+ assert isinstance (image_processor ,
726+ (Qwen2VLImageProcessor , Qwen2VLImageProcessorFast ))
724727 return image_processor
725728
726729
0 commit comments