Add metrics for speculative decoding (acceptance rate, average acceptance length) (#11144)
This commit is contained in:
@@ -378,6 +378,13 @@ class EagleVerifyInput(SpecInput):
|
||||
unfinished_accept_index.append(accept_index[i])
|
||||
req.spec_verify_ct += 1
|
||||
|
||||
# For each request, accumulate # of accepted tokens for this verify pass.
|
||||
accept_length_this_pass = (accept_index != -1).sum(dim=1) - 1
|
||||
for i, (req, accepted_count) in enumerate(
|
||||
zip(batch.reqs, accept_length_this_pass.tolist())
|
||||
):
|
||||
req.spec_accepted_tokens += accepted_count
|
||||
|
||||
if has_finished:
|
||||
accept_length = (accept_index != -1).sum(dim=1) - 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user