Key Error 'loss' while fine tuning GPT-2 with the Trainer utility

Neel-Gupta
Wed, 14 Apr 2021 19:29:19 +0000

Hmm…and would you have any idea if the labels did exist but it still gives the error (despite passing the label_names argument)?

Something like this:

{'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
 'input_ids': [0, 18764, 9665, 38, 3572, 29228, 700, 5029, 102, 2],
 'src': 'Mizoram is ........',
 'tgt': 19}