[BugFix] Fix metrics error for --num-scheduler-steps > 1 (#8234)

This commit is contained in:
yulei
2024-10-23 06:43:03 +08:00
committed by GitHub
parent d1e8240875
commit b17046e298
2 changed files with 48 additions and 0 deletions

View File

@@ -1718,6 +1718,15 @@ class LLMEngine:
# TPOTs.
latency = seq_group.get_last_latency(now)
time_per_output_tokens_iter.append(latency)
if seq_group.state.current_step == 0:
# For async_output_proc, the do_log_stats()
# is called following init_multi_step(), which
# sets the current_step to zero.
actual_num_batched_tokens +=\
seq_group.state.num_steps - 1
else:
actual_num_batched_tokens +=\
seq_group.state.current_step - 1
# Because of chunked prefill, we can have a single sequence
# group that does multiple prompt_runs. To prevent logging