fix bug in python benchmark script #1206
Open
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.
Bug: if we use random token ids (with flag
--use_random_token
), decoding and encoding generates a different set of tokens which is not equal to the original set. This changes the number of prompt tokens and generates incorrect result during benchmarking. e.g.Earlier the number of tokens was 50 but in
new_tokens
it may not be 50.I have removed the step of encoding the prompt again to solve for this but the tokenization latency also need to be removed.
IMO, it is not an important metric as tokenizer is never a bottleneck and this easily resolves the above problem/bug.
Alternatively, if we do not use the
--use_random_token
, then the default way of generating tokens/prompt is very slow.