Remove even more unnecessary load_weights methods (#48496)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
Harry Mellor
2026-07-18 08:40:27 +00:00
committed by GitHub
parent d96aee0951
commit c233d90aa8
44 changed files with 636 additions and 2073 deletions
+8 -11
View File
@@ -7,7 +7,6 @@ from collections.abc import Iterable
import torch
from torch import nn
from vllm._aiter_ops import rocm_aiter_ops
from vllm.compilation.decorators import support_torch_compile
from vllm.config import VllmConfig
from vllm.distributed.parallel_state import get_pp_group
@@ -30,8 +29,8 @@ from vllm.transformers_utils.configs.qwen3_next import Qwen3NextConfig
from .utils import (
AutoWeightsLoader,
WeightsMapper,
make_empty_intermediate_tensors_factory,
maybe_fuse_shared_experts,
maybe_prefix,
)
@@ -154,16 +153,14 @@ class Qwen3NextMultiTokenPredictor(nn.Module):
return hidden_states
def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]) -> set[str]:
mapper = self.hf_to_vllm_mapper
if rocm_aiter_ops.is_fusion_moe_shared_experts_enabled():
# AITER fused-shared-experts: route the shared_expert checkpoint
# weights into the extra fused expert slot.
num_routed = self.config.num_experts
mapper = mapper | WeightsMapper(
orig_to_new_substr={"mlp.shared_expert.": f"mlp.experts.{num_routed}."}
)
weights = maybe_fuse_shared_experts(
weights,
n_routed_experts=self.config.num_experts,
n_shared_experts=1,
ckpt_prefix="mlp.shared_expert",
)
loader = AutoWeightsLoader(self)
return loader.load_weights(weights, mapper=mapper)
return loader.load_weights(weights, mapper=self.hf_to_vllm_mapper)
@support_torch_compile