[Bugfix][MRV2] Support encoder timing stats in model runner V2 (#50020)

Signed-off-by: Guan-Ming (Wesley) Chiu <105915352+guan404ming@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Guan-Ming Chiu
2026-08-12 00:00:49 +08:00
committed by GitHub
co-authored by mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 5426311d91
commit 457a5f34db
7 changed files with 99 additions and 22 deletions
+17
View File
@@ -639,3 +639,20 @@ def is_residual_scattered_for_sp(
assert num_input_tokens % tp == 0
return True
@dataclass
class EncoderTimingStats:
"""Per-request timing statistics for encoder forward pass."""
encoder_forward_secs: float = 0.0
"""Time spent in vision encoder forward pass (seconds)."""
num_encoder_calls: int = 0
"""Number of times encoder was called for this request."""
def to_dict(self) -> dict[str, float | int]:
return {
"encoder_forward_secs": self.encoder_forward_secs,
"num_encoder_calls": self.num_encoder_calls,
}