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

feat: add constrained decoding to HuggingFaceLM #78

Merged
merged 2 commits into from
Oct 25, 2024

Conversation

zaidsheikh
Copy link
Contributor

Description

Added support for constrained decoding in HuggingFaceLM

References

If provided, this function constraints the beam search to allowed tokens only at each step. If not
provided no constraint is applied. This function takes 2 arguments: the batch ID batch_id and
input_ids. It has to return a list with the allowed tokens for the next generation step conditioned
on the batch ID batch_id and the previously generated tokens inputs_ids. This argument is useful
for constrained generation conditioned on the prefix, as described in Autoregressive Entity
Retrieval
.

@zaidsheikh zaidsheikh requested a review from neubig October 25, 2024 01:33
@zaidsheikh zaidsheikh self-assigned this Oct 25, 2024
@neubig neubig merged commit ad11f80 into main Oct 25, 2024
5 checks passed
@neubig neubig deleted the feature/constrained-decoding branch October 25, 2024 12:35
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