This IndexError you get during training means that it tries to query the first element of an empty dataset. However it looks like your dataset is not empty (2 elements), and that you are able to query the first element manually.
So it means that something makes the dataset empty at one point before passing the dataset to the Trainer. Can you also check the length of the dataset after applying this ?
dataset = dataset.map(features.encode_example, features=features)