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

Support multi-process/multi-node sharding for S3IterableDataset #53

Open
jamesbornholt opened this issue Nov 20, 2023 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@jamesbornholt
Copy link
Member

jamesbornholt commented Nov 20, 2023

We currently don't have a built in way to do sharding for S3IterableDataset, so every worker process in a DataLoader will see the same stream of objects. We should have a way to do this.

In the meantime, something like this from torchdata will work as a workaround:

from s3torchconnector import S3IterableDataset
from torch.utils.data import DataLoader
from torch.utils.data.datapipes.iter import IterableWrapper

dataset = S3IterableDataset.from_prefix("s3://doc-example-bucket/", region="us-west-2")
dataset = IterableWrapper(dataset, deepcopy=False)
dataset = dataset.sharding_filter() # Use torchdata's sharding for iterable datasets
loader = DataLoader(dataset, num_workers=2)
@gpicciani gpicciani added the enhancement New feature or request label Nov 23, 2023
@cfregly
Copy link

cfregly commented Mar 19, 2024

Related pull request for Megatron: NVIDIA/Megatron-LM#729

@jamesbornholt
Copy link
Member Author

The torchdata IterableWrapper is being deprecated in a future release, but it will still be present in PyTorch core. I've updated the code example above to point to that instead.

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

No branches or pull requests

3 participants