Optimize the inspection of the dataset

#2
by albertvillanova HF staff - opened

Please note that to inspect the dataset we use functions like get_dataset_config_namesand get_dataset_split_names, which call the method _split_generators of the dataset loading script. This is why we recommend this method to be as light as possible, so that the calls to previous functions are executed immediately. All the costly processing, loading and parsing should be implemented in the _generate_examples method instead.

This PR moves some costly processing functions (loading of ans2label, _load_features) from _split_generators to _generate_examples method. This way the calls to functions get_dataset_config_namesand get_dataset_split_names have no performance issues.

albertvillanova changed pull request status to open

Thanks for the changes!

jimypbr changed pull request status to merged

Works nice, thanks @albertvillanova ! The list of splits and configs is now available in the viewer, and the "test" rows appear immediately: https://huggingface.co/datasets/Graphcore/gqa-lxmert/viewer/gqa/test.

Do you think there would be a way to improve the script to improve streaming on the two other splits (train and validation), since they seem to take a long time to extract the first 100 rows?

Sign up or log in to comment