33
33
import torch .nn .functional as F
34
34
from einops import rearrange
35
35
from 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
38
37
from transformers .models .qwen2_5_vl .configuration_qwen2_5_vl import (
39
38
Qwen2_5_VLConfig , Qwen2_5_VLVisionConfig )
39
+ from transformers .models .qwen2_vl import (Qwen2VLImageProcessor ,
40
+ Qwen2VLImageProcessorFast )
40
41
41
42
from vllm .attention import AttentionMetadata
42
43
from vllm .config import VllmConfig
@@ -693,7 +694,8 @@ def get_hf_processor(
693
694
) -> Qwen2_5_VLProcessor :
694
695
hf_processor = self .ctx .get_hf_processor (Qwen2_5_VLProcessor )
695
696
image_processor = hf_processor .image_processor # type: ignore
696
- assert isinstance (image_processor , Qwen2_5_VLImageProcessor )
697
+ assert isinstance (image_processor ,
698
+ (Qwen2VLImageProcessor , Qwen2VLImageProcessorFast ))
697
699
698
700
if min_pixels :
699
701
image_processor .min_pixels = min_pixels
@@ -713,14 +715,15 @@ def get_image_processor(
713
715
min_pixels : Optional [int ] = None ,
714
716
max_pixels : Optional [int ] = None ,
715
717
fps : Optional [float ] = 2.0 ,
716
- ) -> Qwen2_5_VLImageProcessor :
718
+ ) -> Union [ Qwen2VLImageProcessor , Qwen2VLImageProcessorFast ] :
717
719
hf_processor = self .get_hf_processor (
718
720
min_pixels = min_pixels ,
719
721
max_pixels = max_pixels ,
720
722
fps = fps ,
721
723
)
722
724
image_processor = hf_processor .image_processor # type: ignore
723
- assert isinstance (image_processor , Qwen2_5_VLImageProcessor )
725
+ assert isinstance (image_processor ,
726
+ (Qwen2VLImageProcessor , Qwen2VLImageProcessorFast ))
724
727
return image_processor
725
728
726
729
0 commit comments