moe
moe
¶
Mixture of Experts (MoE) decoder for action prediction.
MoEDecoder
¶
MoEDecoder(base_expert, num_experts, gating_feature_key, inference_gating_key=None, gating_input_dim=None, gating_hidden_dims=None, gating_activation=value, routing_type=value, top_k=2, temperature=1.0, learnable_temperature=False, gating_dropout=0.1, gating_normalization=True)
Bases: BaseMixtureOfExperts, ActionDecoder
Mixture of action decoder experts.
Source code in src/versatil/models/decoding/decoders/moe.py
get_auxiliary_output_keys
¶
MoE decoder produces routing weights and per-expert outputs.
Source code in src/versatil/models/decoding/decoders/moe.py
forward
¶
Forward pass through mixture of expert decoders.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
dict[str, Tensor]
|
Dictionary of input features |
required |
actions
|
dict[str, Tensor] | None
|
Optional ground-truth actions (for training) |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Tensor | list[dict[str, Tensor]]]
|
Dictionary containing: - Combined predictions from routed experts (action keys) - routing_weights: Computed routing weights - expert_outputs: Individual expert prediction dictionaries |
Raises:
| Type | Description |
|---|---|
KeyError
|
If the gating key for the current mode (gating_feature_key
in training, inference_gating_key in eval) is missing from
|