Skip to content

Commit

Permalink
mypy fix
Browse files Browse the repository at this point in the history
Signed-off-by: kevin <[email protected]>
  • Loading branch information
khluu committed Jan 21, 2025
1 parent b1d4d2e commit 1e9b2b9
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions vllm/v1/stats/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
from vllm.sampling_params import SamplingParams


class RequestStatsUpdate(msgspec.Struct,
array_like=True,
omit_defaults=True,
gc=False):
class RequestStatsUpdate(
msgspec.Struct, # type: ignore
array_like=True,
omit_defaults=True,
gc=False):
"""
An update to the request stats.
Expand Down Expand Up @@ -341,16 +342,16 @@ def update_from(self, update: "RequestStatsUpdate"):
self.queued_ts_s = ts
elif update.type == RequestStatsUpdate.Type.PREFILLING:
self.prefill_start_ts_s_lst.append(ts)
self.num_cached_tokens = update.num_cached_tokens
self.num_computed_tokens = update.num_computed_tokens
self.num_cached_tokens = update.num_cached_tokens or 0
self.num_computed_tokens = update.num_computed_tokens or 0
elif update.type == RequestStatsUpdate.Type.PREEMPTED:
self._reset_for_preemption(ts)
elif update.type == RequestStatsUpdate.Type.DECODING:
self.decoding_ts_s_lst.append(ts)
elif update.type == RequestStatsUpdate.Type.DETOKENIZED:
self._record_detokenized_output(
ts,
update.num_new_tokens,
update.num_new_tokens or 0,
)
elif update.type == RequestStatsUpdate.Type.FINISHED:
self.finished_ts_s = ts
Expand Down Expand Up @@ -425,10 +426,11 @@ class EngineCoreProcessStats:
output_queue_size: Optional[int] = None


class EngineCoreStatsSnapshot(msgspec.Struct,
array_like=True,
omit_defaults=True,
gc=False):
class EngineCoreStatsSnapshot(
msgspec.Struct, # type: ignore
array_like=True,
omit_defaults=True,
gc=False):
"""
A snapshot of the EngineCore's current stats over a period of time.
"""
Expand Down

0 comments on commit 1e9b2b9

Please sign in to comment.