Repository navigation
fix(bench): plain_baseline -n 1 no longer divides by zero - #104
Open
fengqiaoqu wants to merge 1 commit into
Open
fengqiaoqu wants to merge 1 commit into
fengqiaoqu wants to merge 1 commit into
Conversation
With max_new_tokens=1, Session.generate skips the decode phase, so decode_tokens and decode_wall_ms stay 0. Computing tok/s then raised ZeroDivisionError. decode_tps returns 0.0 for that prefill-only case. Fixes lithos-ai#63
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
tools/bench/plain_baseline.py -n 1raisesZeroDivisionErroron the first measured prompt.With
max_new_tokens = 1,Session.generate()returns the prefill-sampled token and skips the decode phase (if max_new_tokens > 1 ...), sodecode_wall_msstays0.0anddecode_tokensis0. The script then does:Fix
Add
decode_tps()that returns0.0when there was no decode phase, and use it for the ours path. Contract test covers the-n 1zeros and a normal rate.Verify
pytest tests/contract/test_plain_baseline_decode_tps.py -q # .....Full
plain_baseline.pystill needs a Mac + pack (same as before); this change only stops the crash when-n 1leaves decode empty.Fixes #63