How to use dataset in h5 format?

We recently created a dataset in h5 format. We have one main h5 file with all data index by “id”. For train validation and test splits we have separate txt file with which ids belong to train, val or test set. How can we use _split_generators and _generate_examples in this setting without creating separate h5 files for train, val and test but just reading indexes from corresponding txt files ?