-
Notifications
You must be signed in to change notification settings - Fork 31.2k
Attention mask is important in the case of batching... #16222
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -192,7 +192,6 @@ def preprocess(self, sentence, offset_mapping=None): | |
| truncation = True if self.tokenizer.model_max_length and self.tokenizer.model_max_length > 0 else False | ||
| model_inputs = self.tokenizer( | ||
| sentence, | ||
| return_attention_mask=False, | ||
|
||
| return_tensors=self.framework, | ||
| truncation=truncation, | ||
| return_special_tokens_mask=True, | ||
|
|
||
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.
In random models,
special_tokens_maskwould be extended in the batch with0instead of1so we could still predictPADtoken in the pipeline.I think having
padbeing always considered aspecial_tokens_maskis fine.