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

handle split parameter for DatasetDict.load_dataset() #348

Merged
merged 2 commits into from
Sep 19, 2023

Conversation

ArneBinder
Copy link
Owner

@ArneBinder ArneBinder commented Sep 18, 2023

With this PR, it is possible to call DatasetDict.load_dataset(..., split=SPLIT) or DatasetDict.from_json(..., split=SPLIT) to just load the data of a selected SPLIT. This is helpful when using large datasets where getting the data and calling _generate_document() already takes a lot of time and should not be executed for splits that are not used at all.

Usage:

  • re-install pytorch-ie: pip uninstall pytorch-ie -y && pip install git+https://github.com/ChristophAlt/pytorch-ie.git@load_dataset_with_split
  • call the eval command with +dataset.input.split=test

Changes:

  • DatasetDict.load_dataset() and DatasetDict.from_json(): unwrap split parameter and use it if base load_dataset() returns a simple (Huggingface) (Iterable)Dataset instead of a ...Dict
  • add type checks to DatasetDict.load_dataset()
  • DatasetDict.from_hf(): simplify to only work with (Iterable)DatasetDicts or dicts containing (Iterable)Datasets

…ad_dataset() returns no dataset dict; add type checks
@ArneBinder ArneBinder added the bug Something isn't working label Sep 18, 2023
…ts or dicts containing (Iterable)Datasets; add explicit split parameter to DatasetDict.from_json()
@ArneBinder ArneBinder merged commit 119a725 into main Sep 19, 2023
@ArneBinder ArneBinder deleted the load_dataset_with_split branch September 19, 2023 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant