Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions src/datasets/iterable_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def wrapper(**kwargs):


@dataclass
class ShuffingConfig:
class ShufflingConfig:
seed: Optional[int] = None


Expand All @@ -306,7 +306,7 @@ def __init__(
info: Optional[DatasetInfo] = None,
split: Optional[NamedSplit] = None,
format_type: Optional[str] = None,
shuffling: Optional[ShuffingConfig] = None,
shuffling: Optional[ShufflingConfig] = None,
):
info = info.copy() if info is not None else DatasetInfo()
DatasetInfoMixin.__init__(self, info=info, split=split)
Expand Down Expand Up @@ -425,7 +425,7 @@ def shuffle(self, buffer_size, seed=None) -> "IterableDataset":
buffer_size (:obj:`int`): size of the buffer.
seed (:obj:`int`, optional, default None): random seed that will be used to create the distribution.
"""
shuffling = ShuffingConfig(seed=seed)
shuffling = ShufflingConfig(seed=seed)
return iterable_dataset(
ex_iterable=BufferShuffledExamplesIterable(self._ex_iterable, buffer_size, seed=seed).shuffle_data_sources(
seed=seed
Expand Down Expand Up @@ -477,7 +477,7 @@ def iterable_dataset(
info: Optional[DatasetInfo] = None,
split: Optional[NamedSplit] = None,
format_type: Optional[str] = None,
shuffling: Optional[ShuffingConfig] = None,
shuffling: Optional[ShufflingConfig] = None,
):
if format_type is not None and format_type == "torch":
import torch
Expand Down
4 changes: 2 additions & 2 deletions tests/test_iterable_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
IterableDataset,
MappedExamplesIterable,
RandomlyCyclingMultiSourcesExamplesIterable,
ShuffingConfig,
ShufflingConfig,
SkipExamplesIterable,
TakeExamplesIterable,
_batch_to_examples,
Expand Down Expand Up @@ -296,7 +296,7 @@ def test_iterable_dataset_shuffle(dataset: IterableDataset, generate_examples_fn
buffer_size = 3
dataset._ex_iterable.kwargs["filepaths"] = ["0.txt", "1.txt"]
dataset = dataset.shuffle(buffer_size, seed=seed)
assert isinstance(dataset._shuffling, ShuffingConfig)
assert isinstance(dataset._shuffling, ShufflingConfig)
assert dataset._shuffling.seed == seed
# Effective seed is sum of seed and epoch
if epoch is None:
Expand Down