Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
7fdaaf48
Unverified
Commit
7fdaaf48
authored
Feb 15, 2025
by
Isotr0py
Committed by
GitHub
Feb 15, 2025
Browse files
[Bugfix] Fix qwen2.5-vl image processor (#13286)
parent
067fa225
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
6 deletions
+17
-6
vllm/model_executor/models/qwen2_5_vl.py
vllm/model_executor/models/qwen2_5_vl.py
+8
-5
vllm/model_executor/models/qwen2_vl.py
vllm/model_executor/models/qwen2_vl.py
+9
-1
No files found.
vllm/model_executor/models/qwen2_5_vl.py
View file @
7fdaaf48
...
...
@@ -33,10 +33,11 @@ import torch.nn as nn
import
torch.nn.functional
as
F
from
einops
import
rearrange
from
transformers
import
BatchFeature
from
transformers.models.qwen2_5_vl
import
(
Qwen2_5_VLImageProcessor
,
Qwen2_5_VLProcessor
)
from
transformers.models.qwen2_5_vl
import
Qwen2_5_VLProcessor
from
transformers.models.qwen2_5_vl.configuration_qwen2_5_vl
import
(
Qwen2_5_VLConfig
,
Qwen2_5_VLVisionConfig
)
from
transformers.models.qwen2_vl
import
(
Qwen2VLImageProcessor
,
Qwen2VLImageProcessorFast
)
from
vllm.attention
import
AttentionMetadata
from
vllm.config
import
VllmConfig
...
...
@@ -693,7 +694,8 @@ class Qwen2_5_VLProcessingInfo(Qwen2VLProcessingInfo):
)
->
Qwen2_5_VLProcessor
:
hf_processor
=
self
.
ctx
.
get_hf_processor
(
Qwen2_5_VLProcessor
)
image_processor
=
hf_processor
.
image_processor
# type: ignore
assert
isinstance
(
image_processor
,
Qwen2_5_VLImageProcessor
)
assert
isinstance
(
image_processor
,
(
Qwen2VLImageProcessor
,
Qwen2VLImageProcessorFast
))
if
min_pixels
:
image_processor
.
min_pixels
=
min_pixels
...
...
@@ -713,14 +715,15 @@ class Qwen2_5_VLProcessingInfo(Qwen2VLProcessingInfo):
min_pixels
:
Optional
[
int
]
=
None
,
max_pixels
:
Optional
[
int
]
=
None
,
fps
:
Optional
[
float
]
=
2.0
,
)
->
Qwen2
_5_
VLImageProcessor
:
)
->
Union
[
Qwen2VLImageProcessor
,
Qwen2VLImageProcessor
Fast
]
:
hf_processor
=
self
.
get_hf_processor
(
min_pixels
=
min_pixels
,
max_pixels
=
max_pixels
,
fps
=
fps
,
)
image_processor
=
hf_processor
.
image_processor
# type: ignore
assert
isinstance
(
image_processor
,
Qwen2_5_VLImageProcessor
)
assert
isinstance
(
image_processor
,
(
Qwen2VLImageProcessor
,
Qwen2VLImageProcessorFast
))
return
image_processor
...
...
vllm/model_executor/models/qwen2_vl.py
View file @
7fdaaf48
...
...
@@ -31,7 +31,9 @@ import torch
import
torch.nn
as
nn
import
torch.nn.functional
as
F
from
einops
import
rearrange
,
repeat
from
packaging.version
import
Version
from
transformers
import
BatchFeature
from
transformers
import
__version__
as
TRANSFORMERS_VERSION
from
transformers.models.qwen2_vl
import
(
Qwen2VLImageProcessor
,
Qwen2VLProcessor
)
from
transformers.models.qwen2_vl.configuration_qwen2_vl
import
(
...
...
@@ -746,7 +748,13 @@ class Qwen2VLProcessingInfo(BaseProcessingInfo):
hf_processor
=
self
.
get_hf_processor
(
min_pixels
=
min_pixels
,
max_pixels
=
max_pixels
)
image_processor
=
hf_processor
.
image_processor
# type: ignore
assert
isinstance
(
image_processor
,
Qwen2VLImageProcessor
)
if
Version
(
TRANSFORMERS_VERSION
)
>=
Version
(
"4.49"
):
from
transformers.models.qwen2_vl
import
Qwen2VLImageProcessorFast
assert
isinstance
(
image_processor
,
(
Qwen2VLImageProcessor
,
Qwen2VLImageProcessorFast
))
else
:
assert
isinstance
(
image_processor
,
Qwen2VLImageProcessor
)
return
image_processor
def
get_supported_mm_limits
(
self
)
->
Mapping
[
str
,
Optional
[
int
]]:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment