

TITLE
KeyError: 'eval_loss' when fine-tuning gpt-2 with run_clm.py

COMMENTS
6

REACTIONS
+1: 0
-1: 0
laugh: 0
hooray: 0
heart: 0
rocket: 0
eyes: 0

BODY
## Environment info
- `transformers` version: 4.0.0-rc-1
- Platform: Linux-4.19.0-12-amd64-x86_64-with-glibc2.10
- Python version: 3.8.5
- PyTorch version (GPU?): 1.6.0 (True)
- Tensorflow version (GPU?): 2.2.0 (True)
- Using GPU in script?: yes
- Using distributed or parallel set-up in script?: default option

### Who can help
 albert, bert, GPT2, XLM: @LysandreJik 
 Trainer: @sgugger

## Information

Model I am using (Bert, XLNet ...): GPT2

The problem arises when using:
* [x] the official example scripts: (give details below)
Bug occurs when running run_clm.py file from  transformers/examples/language-modeling/ , the evaluation step (--do_eval) will crash with a python error related to missing KeyError 'eval_loss',

## To reproduce

Steps to reproduce the behavior:

1. Use run_clm.py file from  transformers/examples/language-modeling/
2. Try to fine-tune gpt-2 model, with your own train file and your own validation file
3. When you add "--do_eval" option in run_clm.py then an error will occur when the step "evaluation" is reached :  

```
  File "run_clm.py", line 353, in <module>
    main()
  File "run_clm.py", line 333, in main
    perplexity = math.exp(eval_output["eval_loss"])
KeyError: 'eval_loss'
```
when I try to print the content of eval_output then there is just one key :  "epoch"

the way I execute run_clm.py  : 

```
python run_clm.py \
    --model_name_or_path gpt2 \
    --train_file train.txt \
    --validation_file dev.txt \
    --do_train \
    --do_eval \
    --per_device_train_batch_size 2 \
    --per_device_eval_batch_size 2 \
    --output_dir results/test-clm
```

## Expected behavior
The evaluation step should run without problems.