Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Adding the state-of-the-art contrastive search decoding methods for the codebase of generation_utils.py #19477
Adding the state-of-the-art contrastive search decoding methods for the codebase of generation_utils.py #19477
Changes from 15 commits
942a7c6
5909423
3e71819
47b2b3b
41e37a5
e278a46
38b100f
9abd1bb
32e2a30
e9e2b26
1f1dac2
6226b9a
f3bfd87
d3a91b8
ce26f9f
e801c6f
c78cf91
fb4174e
68429ad
e1f0db9
42d78be
d2a5e02
1d4f782
d5f90fb
d5d30b7
49000c6
3058e1c
c344a0a
628ecda
5ae4ce2
7af4cbb
b219a17
183d7cc
65a1ebd
4972bfb
e11d342
da014bb
2aa768c
ced9f70
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I would maybe not put this in the public init as it could be prone to change in the future and I don't think most people will use it outside of
generate
no?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.
If possible I'd be in favor of not adding a new file here. IMO
ranking_fast
can be changed to a logit processor andContrastiveDecodingOneStepFast
is could be fully moved intogeneration_utils.py
right away.IMO this will be easier to maintain and understand for people that know already how
generate
works - wdyt @gante ?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.
not very happy about passing the
model
into the function here and upper-casing the function.Could we try to have this whole functionality directly inside the
contrastive_search
function? It would help readability a lot IMO.@gante - what do you think?
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.
@gante I think we can/should make this a logit processor that exceptionally takes
context_hidden
andnext_hidden
as inputs arguments as well .top_k_probs
can be computed inside the logit processor,penalty_alpha
andbeam_width
can be stored inside the logic processor at initThere 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.
IMO the logic processor could then (just like all other processors) return the
scores
and then we computeselected_idx
after