Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix incorrect token counting in llm/predictor.py #8769

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

lszxb
Copy link
Contributor

@lszxb lszxb commented Jul 16, 2024

PR types

Bug fixes

PR changes

Others

Description

The benchmark() function is currently counting the number of generated characters instead of the generated tokens, which is incorrect for speed test. This PR modified the predict() interface and let it can optionally return the generated tokens before postprocessing, so that it can count the number of generated tokens in the benchmark() function.

Copy link

paddle-bot bot commented Jul 16, 2024

Thanks for your contribution!

Copy link

codecov bot commented Jul 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.51%. Comparing base (5a508e5) to head (c6c0b6e).
Report is 217 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8769      +/-   ##
===========================================
+ Coverage    55.43%   55.51%   +0.07%     
===========================================
  Files          626      626              
  Lines        98070    98070              
===========================================
+ Hits         54366    54440      +74     
+ Misses       43704    43630      -74     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vivienfanghuagood
Copy link
Contributor

Copy link
Contributor

@DesmonDay DesmonDay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DesmonDay DesmonDay merged commit dedf4c5 into PaddlePaddle:develop Jul 18, 2024
10 of 12 checks passed
@lszxb lszxb deleted the fix_predictor_token_counting branch July 18, 2024 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants