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

[BUGFIX] BART and mBART support 2D attention mask from tokenizer #1637

Merged
merged 2 commits into from
Jan 26, 2022

Conversation

gongel
Copy link
Member

@gongel gongel commented Jan 25, 2022

PR types

Bug fixes

PR changes

Others

Description

@@ -286,7 +286,13 @@ def forward(self, input_ids=None, attention_mask=None, **kwargs):
attention_mask = paddle.cast(
input_ids == self.pad_token_id,
dtype=paddle.get_default_dtype()).unsqueeze([1, 2]) * -1e4
attention_mask.stop_gradient = True

# For 2D attention_mask from tokenizer
Copy link
Member

Choose a reason for hiding this comment

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

注释的位置不对

Copy link
Member Author

Choose a reason for hiding this comment

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

Done and thx.

@gongel gongel merged commit 32d01fa into PaddlePaddle:develop Jan 26, 2022
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.

3 participants