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 tqdm zip bug #5120

Merged
Merged
Changes from 2 commits
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
6 changes: 3 additions & 3 deletions src/datasets/arrow_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2935,9 +2935,9 @@ def init_buffer_and_writer():
len(input_dataset) if not drop_last_batch else len(input_dataset) // batch_size * batch_size
)
pbar_total = (num_rows // batch_size) + 1 if num_rows % batch_size else num_rows // batch_size
pbar_iterable = input_dataset._iter_batches(
pbar_iterable = zip(range(0, num_rows, batch_size), input_dataset._iter_batches(
batch_size, decoded=False, drop_last_batch=drop_last_batch
)
))
pbar_unit = "ex" if not batched else "ba"
pbar_desc = (desc + " " if desc is not None else "") + "#" + str(rank) if rank is not None else desc
pbar = logging.tqdm(
Expand All @@ -2960,7 +2960,7 @@ def init_buffer_and_writer():
else:
writer.write(example)
else:
for i, batch in zip(range(0, num_rows, batch_size), pbar):
for i, batch in pbar:
indices = list(
range(*(slice(i, i + batch_size).indices(input_dataset.num_rows)))
) # Something simpler?
Expand Down