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

If you have this error, it’s probably because you are not passing any labels to your model. It’s hard to know for sure since you don’t explain how you built your dataset.