Remove even more unnecessary load_weights methods (#48496)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
@@ -93,6 +93,7 @@ from .utils import (
|
||||
extract_layer_index,
|
||||
make_empty_intermediate_tensors_factory,
|
||||
make_layers,
|
||||
maybe_fuse_shared_experts,
|
||||
maybe_prefix,
|
||||
)
|
||||
|
||||
@@ -261,20 +262,20 @@ class Qwen3_5Model(Qwen3NextModel):
|
||||
self.aux_hidden_state_layers: tuple[int, ...] = ()
|
||||
|
||||
def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]) -> set[str]:
|
||||
mapper = self.hf_to_vllm_mapper
|
||||
# FSE must match construction (Qwen3NextSparseMoeBlock): reroute the
|
||||
# shared expert into the extra fused slot only when AITER FSE is both
|
||||
# requested and compatible with the quant spec.
|
||||
is_fse = rocm_aiter_ops.is_fusion_moe_shared_experts_enabled() and (
|
||||
_is_shared_expert_fse_compatible(self.quant_config)
|
||||
)
|
||||
if is_fse:
|
||||
num_routed = self.config.num_experts
|
||||
mapper = mapper | WeightsMapper(
|
||||
orig_to_new_substr={"mlp.shared_expert.": f"mlp.experts.{num_routed}."}
|
||||
if "moe" in self.config.model_type:
|
||||
weights = maybe_fuse_shared_experts(
|
||||
weights,
|
||||
enabled=rocm_aiter_ops.is_fusion_moe_shared_experts_enabled()
|
||||
and _is_shared_expert_fse_compatible(self.quant_config),
|
||||
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)
|
||||
|
||||
|
||||
class Qwen3_5ForCausalLMBase(
|
||||
|
||||
Reference in New Issue
Block a user