-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
Conversation
There was a problem hiding this 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 🙇♂️ 🙇♂️
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. |
I made a note to apply it within #8643 |
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!