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
ec2dcd80
Unverified
Commit
ec2dcd80
authored
Jun 03, 2025
by
Isotr0py
Committed by
GitHub
Jun 03, 2025
Browse files
[Misc] Update `WeightsMapper` for qwen2-vl/qwen2.5-vl (#19054)
Signed-off-by:
Isotr0py
<
2037008807@qq.com
>
parent
42243fbd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
vllm/model_executor/models/qwen2_5_vl.py
vllm/model_executor/models/qwen2_5_vl.py
+9
-4
vllm/model_executor/models/qwen2_vl.py
vllm/model_executor/models/qwen2_vl.py
+9
-4
No files found.
vllm/model_executor/models/qwen2_5_vl.py
View file @
ec2dcd80
...
@@ -823,10 +823,15 @@ class Qwen2_5_VLForConditionalGeneration(nn.Module, SupportsMultiModal,
...
@@ -823,10 +823,15 @@ class Qwen2_5_VLForConditionalGeneration(nn.Module, SupportsMultiModal,
SupportsLoRA
,
SupportsPP
):
SupportsLoRA
,
SupportsPP
):
# To ensure correct weight loading and mapping.
# To ensure correct weight loading and mapping.
hf_to_vllm_mapper
=
WeightsMapper
(
orig_to_new_prefix
=
{
hf_to_vllm_mapper
=
WeightsMapper
(
"lm_head."
:
"language_model.lm_head."
,
orig_to_new_prefix
=
{
"model."
:
"language_model.model."
,
# mapping for new names in checkpoint saved after transformers v4.52
})
"model.language_model."
:
"language_model.model."
,
"model.visual."
:
"visual."
,
# mapping for original checkpoint
"lm_head."
:
"language_model.lm_head."
,
"model."
:
"language_model.model."
,
})
def
__init__
(
self
,
*
,
vllm_config
:
VllmConfig
,
prefix
:
str
=
""
):
def
__init__
(
self
,
*
,
vllm_config
:
VllmConfig
,
prefix
:
str
=
""
):
super
().
__init__
()
super
().
__init__
()
...
...
vllm/model_executor/models/qwen2_vl.py
View file @
ec2dcd80
...
@@ -1071,10 +1071,15 @@ class Qwen2VLForConditionalGeneration(nn.Module, SupportsMultiModal,
...
@@ -1071,10 +1071,15 @@ class Qwen2VLForConditionalGeneration(nn.Module, SupportsMultiModal,
SupportsLoRA
,
SupportsPP
):
SupportsLoRA
,
SupportsPP
):
# To ensure correct weight loading and mapping.
# To ensure correct weight loading and mapping.
hf_to_vllm_mapper
=
WeightsMapper
(
orig_to_new_prefix
=
{
hf_to_vllm_mapper
=
WeightsMapper
(
"lm_head."
:
"language_model.lm_head."
,
orig_to_new_prefix
=
{
"model."
:
"language_model.model."
,
# mapping for new names in checkpoint saved after transformers v4.52
})
"model.language_model."
:
"language_model.model."
,
"model.visual."
:
"visual."
,
# mapping for original checkpoint
"lm_head."
:
"language_model.lm_head."
,
"model."
:
"language_model.model."
,
})
def
__init__
(
self
,
*
,
vllm_config
:
VllmConfig
,
prefix
:
str
=
""
):
def
__init__
(
self
,
*
,
vllm_config
:
VllmConfig
,
prefix
:
str
=
""
):
super
().
__init__
()
super
().
__init__
()
...
...
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