Skip to content

Fix shard computation in NoShuffleBeamWriter with overlapping split names #11070

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lgeiger
Copy link
Collaborator

@lgeiger lgeiger commented Jun 16, 2025

Currently NoShuffleBeamWriter would compute the wrong number of shards for cases where splits have overlapping names.

E.g. given a dataset with two splits foo and foo_bar the generated tfrecord files would look something like this:

builder-foo.tfrecord-00000-of-00003
builder-foo.tfrecord-00001-of-00003
builder-foo.tfrecord-00002-of-00003
builder-foo_bar.tfrecord-00000-of-00002
builder-foo_bar.tfrecord-00001-of-00002

The current regex for the foo split would be builder-foo* which also matches the files of the foo_bar split. This results in the number of shards for foo to also include shards from the other split. This fixes it by changing the regex to builder-foo.*.

@lgeiger
Copy link
Collaborator Author

lgeiger commented Jun 17, 2025

@tomvdw Do you mind having a look at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant