mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-13 21:25:33 +08:00
[Misc] Update WeightsMapper for qwen2-vl/qwen2.5-vl (#19054)
Signed-off-by: Isotr0py <2037008807@qq.com>
This commit is contained in:
parent
42243fbda0
commit
ec2dcd80bc
@ -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__()
|
||||||
|
|||||||
@ -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__()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user