[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:
co-authored by
mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent
5426311d91
commit
457a5f34db
@@ -10,7 +10,7 @@ from collections import defaultdict
|
||||
from collections.abc import Callable, Iterable, Iterator, Sequence
|
||||
from contextlib import AbstractContextManager, contextmanager, nullcontext
|
||||
from copy import copy, deepcopy
|
||||
from dataclasses import dataclass, replace
|
||||
from dataclasses import replace
|
||||
from functools import reduce
|
||||
from typing import TYPE_CHECKING, Any, NamedTuple, TypeAlias, cast
|
||||
|
||||
@@ -230,7 +230,11 @@ from vllm.v1.worker.ubatch_utils import (
|
||||
maybe_create_ubatch_slices,
|
||||
split_attn_metadata,
|
||||
)
|
||||
from vllm.v1.worker.utils import is_residual_scattered_for_sp, raise_if_nan_logits
|
||||
from vllm.v1.worker.utils import (
|
||||
EncoderTimingStats,
|
||||
is_residual_scattered_for_sp,
|
||||
raise_if_nan_logits,
|
||||
)
|
||||
from vllm.v1.worker.workspace import lock_workspace
|
||||
|
||||
from .utils import (
|
||||
@@ -7948,20 +7952,3 @@ class GPUModelRunner(
|
||||
stats = self.encoder_timing_registry[req_id]
|
||||
stats.encoder_forward_secs += per_request_time
|
||||
stats.num_encoder_calls += 1
|
||||
|
||||
|
||||
@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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user