[Models] Cohere MoE (#40817)

Signed-off-by: Terrencezzj <terrence@cohere.ai>
This commit is contained in:
Terrence Zhao
2026-04-29 15:54:54 +00:00
committed by GitHub
parent a05848e255
commit 91a2d39014
7 changed files with 554 additions and 3 deletions
@@ -263,6 +263,7 @@ class TrtLlmNvFp4ExpertsMonolithic(
RoutingMethodType.SigmoidRenorm,
RoutingMethodType.MiniMax2,
RoutingMethodType.Simulated,
RoutingMethodType.SigmoidRenorm,
]
@staticmethod
@@ -34,11 +34,15 @@ class CustomRoutingRouter(BaseRouter):
@property
def routing_method_type(self) -> RoutingMethodType:
from vllm.model_executor.models.cohere_moe import token_choice_with_bias
from vllm.model_executor.models.llama4 import Llama4MoE
# NOTE: FLASHINFER_TRTLLM support the Llama4 router.
if self.custom_routing_function == Llama4MoE.custom_routing_function:
return RoutingMethodType.Llama4
# Cohere MoE uses a sigmoid -> top-k -> renormalize routing function.
if self.custom_routing_function == token_choice_with_bias:
return RoutingMethodType.SigmoidRenorm
return RoutingMethodType.Custom
def _compute_routing(