-
Notifications
You must be signed in to change notification settings - Fork 152
Allow top-k and top-p to coexist #27
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
Conversation
- added LogitsProcessor - changed generation to use LogitsProcessor - added tests
pcuenca
left a comment
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.
Great job, @jkrukowski, sorry for taking long to review 🙏
I think the PR is in very good shape and can be merged quickly. I like that it follows the transformers pattern and is super clean and easy to follow. I only have two comments:
- We should always use the nomenclature
warperin all file, class, and variable names. - I think it's a bit more expressive if the
LogitsWarperprotocol has a method calledwarp, and a defaultcallAsFunctionmethod that simply callswarp. We'd use the implicit call most of the time for symmetry with transformers, but users may also choose to callwarpif they prefer, and the semantics would be clear.
Thanks a lot for another great contribution!
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.
Thanks a lot for adding tests too! 🙌
|
@pcuenca applied the requested changes, please take a 2nd look |
pcuenca
left a comment
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.
Thanks a lot!
This PR is based on the comment #23 (comment)
@pcuenca please let me know if that's what you had in mind.
This PR:
LogitsWrapperbased on https://github.com/huggingface/transformers/blob/42017d82baa083da2bee3055fdac80c81ee97b8a/src/transformers/generation/logits_process.py#L62LogitsProcessorbased on https://github.com/huggingface/transformers/blob/42017d82baa083da2bee3055fdac80c81ee97b8a/src/transformers/generation/logits_process.py#L73LogitsProcessor