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

grammars: fix resampling logic regression #7424

Merged
merged 2 commits into from
May 21, 2024

Conversation

ochafik
Copy link
Collaborator

@ochafik ochafik commented May 21, 2024

I think #6240 may have undone the performance gains of #4306 (just because of extra negation in !is_resampling)

This brings them back / makes grammar sampling fast again! (#4218)

I've tested this along with #7370 (early exit) & #6811 (cache codepoints) & other changes (see benchmarks): looks like only this PR & to a lesser degree, the codepoint caching, are needed / useful.

cc/ @kalomaze, @mscheong01, @HanClinto, @AlienKevin

I'm not sure if the performance benchmark bot would now catch this kind of regression, ideas welcome!

@ochafik ochafik added performance Speed related topics and removed examples labels May 21, 2024
@mofosyne mofosyne added the Review Complexity : Low Trivial changes to code that most beginner devs (or those who want a break) can tackle. e.g. UI fix label May 21, 2024
Copy link
Collaborator

@mscheong01 mscheong01 left a comment

Choose a reason for hiding this comment

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

Yes, I believe this fix is valid. My PR modifies the optimization behavior to apply grammar checks first and then resample without them if necessary(which wouldn't happen at all since grammar checks are already applied) while it should be the opposite. Thank you for addressing this 🙇‍♂️ 🙇‍♂️

@HanClinto
Copy link
Collaborator

Sorry I missed reviewing this before -- this would have been good to get vetted / merged, but now I suspect that this is going to conflict a fair bit with #8643 -- I'm not sure how imminent that PR is, but this one still may be worth pushing through.

@ggerganov ggerganov mentioned this pull request Aug 9, 2024
6 tasks
@ggerganov
Copy link
Owner

I made a note to apply it within #8643

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples performance Speed related topics Review Complexity : Low Trivial changes to code that most beginner devs (or those who want a break) can tackle. e.g. UI fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants