Filter non-int token ids in benchmark and observe decode-side bootstrap/alloc metrics (#24684)
This commit is contained in:
@@ -66,8 +66,12 @@ def compute_random_lens(full_len: int, range_ratio: float, num: int) -> List[int
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def get_available_tokens(tokenizer):
|
||||
"""Get all available token ids from the tokenizer vocabulary."""
|
||||
return list(tokenizer.get_vocab().values())
|
||||
"""Get valid token ids from the tokenizer vocabulary."""
|
||||
return [
|
||||
token_id
|
||||
for token_id in tokenizer.get_vocab().values()
|
||||
if isinstance(token_id, int)
|
||||
]
|
||||
|
||||
|
||||
def gen_prompt(tokenizer, token_num):
|
||||
|
||||
@@ -936,6 +936,16 @@ class SchedulerReqTimeStats(ReqTimeStatsBase):
|
||||
)
|
||||
self.trace_slice(stage, self.decode_prealloc_queue_entry_time, ts)
|
||||
|
||||
if self.enable_metrics and self.bootstrap_done_time > 0:
|
||||
bootstrap_ms = (
|
||||
self.bootstrap_done_time - self.decode_prealloc_queue_entry_time
|
||||
) * 1000
|
||||
alloc_ms = (ts - self.bootstrap_done_time) * 1000
|
||||
self.metrics_collector.observe_kv_transfer_bootstrap(
|
||||
bootstrap_ms=bootstrap_ms,
|
||||
alloc_ms=alloc_ms,
|
||||
)
|
||||
|
||||
def set_bootstrap_done_time(self, ts=None):
|
||||
ts = ts or time.perf_counter()
|
||||
if self.bootstrap_done_time == 0.0:
|
||||
|
||||
Reference in New Issue
Block a user