[Bugfix][MoE] Keep the gate's hash_indices_table out of RoutedExperts parameters (#61930)

Signed-off-by: khluu <khluu000@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin H. Luu
2026-10-15 18:00:17 -07:00
committed by GitHub
co-authored by Claude Opus 5.5
parent bee95149e2
commit a956a8126e
2 changed files with 3 additions and 4 deletions
@@ -439,8 +439,6 @@ def FusedMoEFactory(
hash_indices_table=hash_indices_table,
**routed_experts_args if routed_experts_args is not None else {},
)
if hash_indices_table is not None:
object.__setattr__(routed_experts, "hash_indices_table", hash_indices_table)
if runner_cls is None:
runner_cls = MoERunner
@@ -79,7 +79,7 @@ class RoutedExperts(PluggableLayer):
- Executing routed experts via quant_method.apply()
"""
# Hash-routing table, owned by the gate; set by FusedMoEFactory.
# Hash-routing table, owned by the gate.
hash_indices_table: torch.Tensor | None = None
def __init__(
@@ -156,7 +156,8 @@ class RoutedExperts(PluggableLayer):
# Set by bind_routed_experts_capturer for monolithic kernels.
self.routing_sink: RoutedExpertsSink | None = None
self.apply_router_weight_on_input = apply_router_weight_on_input
self.hash_indices_table = hash_indices_table
# The gate owns this Parameter: keep it out of this module's parameters.
object.__setattr__(self, "hash_indices_table", hash_indices_table)
# End random parameters
self._loaded_expert_biases: set[str] = set()
self._fused_shared_expert_quantizer = self._get_fused_shared_expert_quantizer()