IndexError: Invalid key: 16 is out of bounds for size 0

Hi ! You are using the transformers Trainer. Please note that the trainer does drop all the dataset columns that are not actual input to the models for training. If the dataset ends up with no columns, its size becomes zero.

In particular in your case, the Trainer must have logged

***** Running training *****
  Num examples = 0
  Num Epochs = 3
  ...

Can you try setting remove_unused_columns=False in the training arguments ?

16 Likes