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

implement DatasetDict.shuffle #154

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
9 changes: 9 additions & 0 deletions src/pie_datasets/core/dataset_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,15 @@
)
return result

def shuffle(self, **kwargs):
result = DatasetDict.from_hf(super().shuffle(**kwargs), document_type=self.document_type)

Check warning on line 698 in src/pie_datasets/core/dataset_dict.py

View check run for this annotation

Codecov / codecov/patch

src/pie_datasets/core/dataset_dict.py#L698

Added line #L698 was not covered by tests

# TODO: integrate into DatasetDict.from_hf
for split_name, split in result.items():
split.document_converters = self[split_name].document_converters

Check warning on line 702 in src/pie_datasets/core/dataset_dict.py

View check run for this annotation

Codecov / codecov/patch

src/pie_datasets/core/dataset_dict.py#L701-L702

Added lines #L701 - L702 were not covered by tests

return result

Check warning on line 704 in src/pie_datasets/core/dataset_dict.py

View check run for this annotation

Codecov / codecov/patch

src/pie_datasets/core/dataset_dict.py#L704

Added line #L704 was not covered by tests


def load_dataset(*args, **kwargs) -> Union[DatasetDict, Dataset, IterableDataset]:
dataset_or_dataset_dict = datasets.load_dataset(*args, **kwargs)
Expand Down
Loading