-
Notifications
You must be signed in to change notification settings - Fork 25.2k
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
[Sequence Feature Extraction] Add truncation #12804
[Sequence Feature Extraction] Add truncation #12804
Conversation
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.
Thanks for adding this new feature! My main comment is on the default for truncation
(why have None if it's just a True/False flag), the rest are just nits.
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.
LGTM! Great tests.
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
…into add_truncation_to_feature_extract
…into add_truncation_to_feature_extract
What does this PR do?
This PR adds
truncation
to speech-related feature extractors. It should enable use cases such as: #12774Different to our tokenizers we allow truncation to be just True or False => there is no "truncation strategy". The reason is that for feature extractors the input cannot be a "pair" of input sequences so there is essentially just one use case for truncation that applies to all inputs.
The logic is equivalent to Tokenizers with a small exception in error handling. The differences are shown in example 1. & 2. in the following:
In addition
pad_to_multiple_of
works correctly and equivalent to the Tokenizers. Tests are added to cover all possible use cases.Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
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.