[Feature] Support recording expert indices for rollout router replay (#28284)

Signed-off-by: xhx1022 <1737006628@qq.com>
Signed-off-by: Hongxin Xu <70438206+xhx1022@users.noreply.github.com>
Signed-off-by: arlenxu <arlenxu@tencent.com>
Co-authored-by: 22quinn <33176974+22quinn@users.noreply.github.com>
Co-authored-by: arlenxu <arlenxu@tencent.com>
This commit is contained in:
Hongxin Xu
2026-01-12 06:23:04 -08:00
committed by GitHub
co-authored by 22quinn arlenxu
parent 0565f1fdec
commit 49e6b86c91
11 changed files with 463 additions and 3 deletions
+3
View File
@@ -6,6 +6,7 @@ from collections.abc import Sequence as GenericSequence
from dataclasses import dataclass
from typing import Any, Generic
import numpy as np
import torch
from typing_extensions import TypeVar
@@ -42,6 +43,7 @@ class CompletionOutput:
token_ids: GenericSequence[int]
cumulative_logprob: float | None
logprobs: SampleLogprobs | None
routed_experts: np.ndarray | None = None # [seq_len,layer_num,topk]
finish_reason: str | None = None
stop_reason: int | str | None = None
lora_request: LoRARequest | None = None
@@ -54,6 +56,7 @@ class CompletionOutput:
f"CompletionOutput(index={self.index}, "
f"text={self.text!r}, "
f"token_ids={self.token_ids}, "
f"routed_experts={self.routed_experts}, "
f"cumulative_logprob={self.cumulative_logprob}, "
f"logprobs={self.logprobs}, "
f"finish_reason={self.finish_reason}, "