Skip to content

Conversation

@jkrukowski
Copy link
Contributor

This PR is based on the comment #23 (comment)

@pcuenca please let me know if that's what you had in mind.

This PR:

- added LogitsProcessor
- changed generation to use LogitsProcessor
- added tests
Copy link
Member

@pcuenca pcuenca left a 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 warper in all file, class, and variable names.
  • I think it's a bit more expressive if the LogitsWarper protocol has a method called warp, and a default callAsFunction method that simply calls warp. We'd use the implicit call most of the time for symmetry with transformers, but users may also choose to call warp if they prefer, and the semantics would be clear.

Thanks a lot for another great contribution!

Copy link
Member

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! 🙌

@jkrukowski
Copy link
Contributor Author

@pcuenca applied the requested changes, please take a 2nd look

Copy link
Member

@pcuenca pcuenca left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

@pcuenca pcuenca merged commit 41fb1df into huggingface:main Dec 19, 2023
@jkrukowski jkrukowski deleted the sampling-interface branch December 19, 2023 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants