Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I saved a dataset with two splits to disk with
DatasetDict.save_to_disk
. The train is bigger and ended up in 10 shards, whereas the test split only resulted in 1 split.Now when trying to load the dataset, an error is raised that not all splits have the same data format:
This is not expected because both splits are saved as arrow files.
I did some debugging and found that this is the case because the list of data_files includes a
state.json
file.Now this means for train split I get 10 ".arrow" and 1 ".json" file. Since datasets picks based on the most common extension this is correctly inferred as "arrow". In the test split, there is 1 .arrow and 1 .json file. Given the function description:
This is not quite true though, because in a tie the extensions are actually based on reverse-alphabetical order:
Which thus leads to the module wrongly inferred as "json", whereas it should be "arrow", matching the train split.
I first thought about adding "state.json" in the list of excluded files for the inference: https://github.com/huggingface/datasets/blob/main/src/datasets/load.py#L513. However, I think from digging into the code it looks like the right thing to do is to exclude it in the list of
data_files
to start with, because it is more of a metadata than a data file.