Skip to content

add test for shuffle before shard #1738

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

Merged
merged 6 commits into from
May 31, 2022
Merged
Changes from all 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
3 changes: 3 additions & 0 deletions test/datasets/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from parameterized import parameterized
from torch.utils.data.graph import traverse
from torch.utils.data.graph_settings import get_all_graph_pipes
from torchdata.dataloader2.linter import _check_shuffle_before_sharding
from torchdata.datapipes.iter import Shuffler, ShardingFilter
from torchtext.datasets import DATASETS

Expand Down Expand Up @@ -34,6 +35,8 @@ def test_shuffle_shard_wrapper(self, dataset_fn):
dp = [dp]

for dp_split in dp:
_check_shuffle_before_sharding(dp_split)

dp_graph = get_all_graph_pipes(traverse(dp_split))
for annotation_dp_type in [Shuffler, ShardingFilter]:
if not any(isinstance(dp, annotation_dp_type) for dp in dp_graph):
Expand Down