Skip to content

Conversation

@affjljoo3581
Copy link
Contributor

@affjljoo3581 affjljoo3581 commented Oct 10, 2021

What does this PR do?

While the input sequences are padded by tokenizer.pad which makes the length of the sequences to be a multiple of pad_to_multiple_of, the label sequences are padded to the maximum length among them without considering pad_to_multiple_of. This PR changes DataCollatorForSeq2Seq class to make sure that the labels have their lengths to be a multiple of the given value.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

@sgugger

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

Great, thanks a lot for adding this!

@sgugger sgugger merged commit 6e4c8f6 into huggingface:master Oct 11, 2021
@affjljoo3581 affjljoo3581 deleted the seq2seq_collator_pad_labels_to_multiple_of branch October 11, 2021 13:41
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