-
Notifications
You must be signed in to change notification settings - Fork 26.3k
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
Multiple token prediction with MLM #4306
Comments
An error message would be great, want to submit a PR? For multiple masked token support, I'm not entirely sure. The sampling might be very use case-specific. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I'm facing a situation where I've to fetch probabilities from BERT MLM for multiple words in a single sentence.
But BERT MLM task doesn't consider two tokens at a time for the MASK. |
Here's how to mask multiple tokens.
|
🚀 Feature request
It would be great if the
fill_mask
interface would be able to predict multiple tokens at a time.Motivation
I didn't find any related issue. Using transformer for chemical data, queries like
fill_mask('CCCO<mask>C')
work fine. But writingfill_mask('CC<mask>CO<mask>C')
I obtain:Your contribution
The user can easily implement an auto-regressive solution and given that
fill_mask
returns thetopk
tokens, one could even select between greedy search, beam search or a probabilistic sampling. But a one-shot approach would be preferable since it minimizes probabilities to aggregate errors as in auto-regression. Rather than outsourcing this to the user, I'd prefer a solution integrated into the package.As minimum request, I would like to propose to raise a proper error message instead of the obtained
ValueError
.The text was updated successfully, but these errors were encountered: