mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-21 16:45:01 +08:00
[Bugfix] Fix Qwen3-VL-MoE weight loading for EP (#25300)
Signed-off-by: Roger Wang <hey@rogerw.io> Signed-off-by: yewentao256 <zhyanwentao@126.com>
This commit is contained in:
parent
267b4421b7
commit
0ac65d171b
@ -122,9 +122,10 @@ class Qwen3MoeLLMModel(Qwen3MoeModel):
|
|||||||
|
|
||||||
def load_fused_expert_weights(self, name: str, params_dict: dict,
|
def load_fused_expert_weights(self, name: str, params_dict: dict,
|
||||||
loaded_weight: torch.Tensor, shard_id: str,
|
loaded_weight: torch.Tensor, shard_id: str,
|
||||||
num_experts: int):
|
num_experts: int) -> bool:
|
||||||
param = params_dict[name]
|
param = params_dict[name]
|
||||||
weight_loader = typing.cast(Callable[..., bool], param.weight_loader)
|
weight_loader = typing.cast(Callable[..., bool], param.weight_loader)
|
||||||
|
loaded_local_expert = False
|
||||||
for expert_id in range(num_experts):
|
for expert_id in range(num_experts):
|
||||||
curr_expert_weight = loaded_weight[expert_id]
|
curr_expert_weight = loaded_weight[expert_id]
|
||||||
success = weight_loader(param,
|
success = weight_loader(param,
|
||||||
@ -133,9 +134,10 @@ class Qwen3MoeLLMModel(Qwen3MoeModel):
|
|||||||
shard_id,
|
shard_id,
|
||||||
expert_id,
|
expert_id,
|
||||||
return_success=True)
|
return_success=True)
|
||||||
if not success:
|
if success:
|
||||||
return False
|
loaded_local_expert = True
|
||||||
return True
|
|
||||||
|
return loaded_local_expert
|
||||||
|
|
||||||
def load_weights(self, weights: Iterable[tuple[str,
|
def load_weights(self, weights: Iterable[tuple[str,
|
||||||
torch.Tensor]]) -> set[str]:
|
torch.Tensor]]) -> set[str]:
|
||||||
@ -345,4 +347,4 @@ class Qwen3VLMoeForConditionalGeneration(Qwen3VLForConditionalGeneration):
|
|||||||
for _ in range(self.deepstack_num_level)
|
for _ in range(self.deepstack_num_level)
|
||||||
] if self.use_deepstack else None
|
] if self.use_deepstack else None
|
||||||
self.visual_dim = config.vision_config.out_hidden_size
|
self.visual_dim = config.vision_config.out_hidden_size
|
||||||
self.multiscale_dim = self.visual_dim * self.deepstack_num_level
|
self.multiscale_dim = self.visual_dim * self.deepstack_num_level
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user