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 wrong documentation about DataCollator padding defaults #21919

Merged
merged 2 commits into from
Mar 3, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/transformers/data/data_collator.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,11 @@ class DataCollatorForTokenClassification(DataCollatorMixin):
Select a strategy to pad the returned sequences (according to the model's padding side and padding index)
among:

- `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single sequence
- `True` or `'longest'` (default): Pad to the longest sequence in the batch (or no padding if only a single sequence
is provided).
- `'max_length'`: Pad to a maximum length specified with the argument `max_length` or to the maximum
acceptable input length for the model if that argument is not provided.
- `False` or `'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of different
- `False` or `'do_not_pad'`: No padding (i.e., can output a batch with sequences of different
lengths).
max_length (`int`, *optional*):
Maximum length of the returned list and optionally padding length (see above).
Expand Down Expand Up @@ -531,11 +531,11 @@ class DataCollatorForSeq2Seq:
Select a strategy to pad the returned sequences (according to the model's padding side and padding index)
among:

- `True` or `'longest'`: Pad to the longest sequence in the batch (or no padding if only a single sequence
- `True` or `'longest'` (default): Pad to the longest sequence in the batch (or no padding if only a single sequence
is provided).
- `'max_length'`: Pad to a maximum length specified with the argument `max_length` or to the maximum
acceptable input length for the model if that argument is not provided.
- `False` or `'do_not_pad'` (default): No padding (i.e., can output a batch with sequences of different
- `False` or `'do_not_pad'`: No padding (i.e., can output a batch with sequences of different
lengths).
max_length (`int`, *optional*):
Maximum length of the returned list and optionally padding length (see above).
Expand Down