Unverified Commit 6e4c8f68 authored by Jungwoo Park's avatar Jungwoo Park Committed by GitHub
Browse files

change to apply `pad_to_multiple_of` to labels (#13949)

parent dca67968
......@@ -534,6 +534,13 @@ class DataCollatorForSeq2Seq:
# same length to return tensors.
if labels is not None:
max_label_length = max(len(l) for l in labels)
if self.pad_to_multiple_of is not None:
max_label_length = (
(max_label_length + self.pad_to_multiple_of - 1)
// self.pad_to_multiple_of
* self.pad_to_multiple_of
)
padding_side = self.tokenizer.padding_side
for feature in features:
remainder = [self.label_pad_token_id] * (max_label_length - len(feature["labels"]))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment