workaround so training doesn't hang when packed dataloader batches aren't even (#461)

* workaround so training doesn't hang when packed dataloader batches aren't even

* don't bother labeling anything in the no-op data
This commit is contained in:
Wing Lian
2023-08-23 10:39:11 -04:00
committed by GitHub
parent d5dcf9c350
commit c69faee7a7

View File

@@ -243,6 +243,18 @@ class MultipackDistributedDataloader:
len_remaining -= 1
if not len_remaining:
return
# yield a no-op for cases where we don't have any data left to pack
for i in range(0, len_remaining):
yield self.collate_fn(
[
{
"input_ids": [0],
"labels": [-100],
"attention_mask": [True],
"position_ids": [0],
}
]
)
def _len_est(self):
lengths_sum = np.sum(self.lengths)