Optimize the inspection of the dataset
Please note that to inspect the dataset we use functions like get_dataset_config_names
and 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_names
and get_dataset_split_names
have no performance issues.
Thanks for the changes!
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?