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

Fix Seq2seqTrainer decoder attention mask #26841

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

Rocketknight1
Copy link
Member

The Seq2SeqTrainer drops decoder_input_ids during the generation step for metrics that expect text generation (like rouge) when labels is present. However, it doesn't drop decoder_attention_mask when it does this, which means that in some cases, we pass decoder_attention_mask with no decoder_input_ids, resulting in the model getting very confused and throwing a shape error.

This PR fixes the issue.

Fixes #24567

@Rocketknight1
Copy link
Member Author

cc @gante and @ydshieh because I see you in the git blame near here - let me know if this is okay, or if I'm breaking anything with this fix!

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

Copy link
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

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

Ohh super nice thanks for fixing it!

@Rocketknight1 Rocketknight1 merged commit 34678db into main Oct 18, 2023
3 checks passed
@Rocketknight1 Rocketknight1 deleted the seq2seq_trainer_attention_mask_fix branch October 18, 2023 12:28
EduardoPach pushed a commit to EduardoPach/transformers that referenced this pull request Nov 19, 2023
Don't drop decoder_input_ids without also dropping decoder_attention_mask
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.

MT5 data padding not working
3 participants