I was finetuning BertForQuestionAnswering on nlp squad dateset with the following arguments
training_args = TrainingArguments(
    "test-qa-squad",
    learning_rate=2e-5,
    weight_decay=0.01,
    label_names = ["start_positions", "end_positions"],
    num_train_epochs=5,
    load_best_model_at_end=True,
    evaluation_strategy='epoch'
)

trainer = Trainer(
    model=model,
    args=training_args,
    train_dataset=train_dl,
    eval_dataset=train_dl
)

Then doing trainer.train() trains for some batches but then after a specific batch throws this error (one epoch isn’t complete yet)
KeyError                                  Traceback (most recent call last)

<ipython-input-19-3435b262f1ae> in <module>()
----> 1 trainer.train()

3 frames

/usr/local/lib/python3.7/dist-packages/transformers/file_utils.py in __getitem__(self, k)
   1444         if isinstance(k, str):
   1445             inner_dict = {k: v for (k, v) in self.items()}
-> 1446             return inner_dict[k]
   1447         else:
   1448             return self.to_tuple()[k]

KeyError: 'loss'

Is this some issue in the dataset? Any help is much appreciated