When I use run_ner.py to fine-tune the model based on Bert, I cannot predict any entities
Author: lisa563
Pull request: no

## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->

- `transformers` version: 4.6.0.dev0
- Platform: windows 7
- Python version: 3.8.8
- PyTorch version (GPU?): 
- Tensorflow version (GPU?): 2.4.1 (False)
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No

Steps to reproduce the behavior:

1. Use the first 8 items in sample.json as train.json;
2. Use item 9 in sample.json as test.json;
3. Use run_ner.py to fine tune bert model;
`python run_ner.py --model_name_or_path bert-base-uncased --train_file transformers_train.json --validation_file transformers_test.json --output_dir /tmp/transformers_8 --do_train --do_eval`
4. Use item 10 in sample.json to predict;

## Expected behavior
1. All prediction results are LABEL_5;
`
[{'word': 'clinton', 'score': 0.48847222328186035, 'entity': 'LABEL_5', 'index': 1, 'start': 0, 'end': 7}, {'word': 'flew', 'score': 0.5289798974990845, 'entity': 'LABEL_5', 'index': 2, 'start': 8, 'end': 12}, {'word': 'in', 'score': 0.5855543613433838, 'entity': 'LABEL_5', 'index': 3, 'start': 13, 'end': 15}, {'word': 'by', 'score': 0.5611563324928284, 'entity': 'LABEL_5', 'index': 4, 'start': 16, 'end': 18}, {'word': 'helicopter', 'score': 0.464128702878952, 'entity': 'LABEL_5', 'index': 5, 'start': 19, 'end': 29}, {'word': 'from', 'score': 0.4999557435512543, 'entity': 'LABEL_5', 'index': 6, 'start': 30, 'end': 34}, {'word': 'michigan', 'score': 0.4572168290615082, 'entity': 'LABEL_5', 'index': 7, 'start': 35, 'end': 43}, {'word': 'city', 'score': 0.52681964635849, 'entity': 'LABEL_5', 'index': 8, 'start': 44, 'end': 48}, {'word': ',', 'score': 0.5917312502861023, 'entity': 'LABEL_5', 'index': 9, 'start': 49, 'end': 50}, {'word': 'indiana', 'score': 0.4882311224937439, 'entity': 'LABEL_5', 'index': 10, 'start': 51, 'end': 58}, {'word': ',', 'score': 0.43045851588249207, 'entity': 'LABEL_5', 'index': 11, 'start': 59, 'end': 60}, {'word': 'after', 'score': 0.5621852874755859, 'entity': 'LABEL_5', 'index': 12, 'start': 61, 'end': 66}, {'word': 'ending', 'score': 0.45101162791252136, 'entity': 'LABEL_5', 'index': 13, 'start': 67, 'end': 73}, {'word': 'a', 'score': 0.5589421987533569, 'entity': 'LABEL_5', 'index': 14, 'start': 74, 'end': 75}, {'word': 'four', 'score': 0.46818190813064575, 'entity': 'LABEL_5', 'index': 15, 'start': 76, 'end': 80}, {'word': '-', 'score': 0.5488259196281433, 'entity': 'LABEL_5', 'index': 16, 'start': 80, 'end': 81}, {'word': 'day', 'score': 0.5397554636001587, 'entity': 'LABEL_5', 'index': 17, 'start': 81, 'end': 84}, {'word': ',', 'score': 0.36657819151878357, 'entity': 'LABEL_5', 'index': 18, 'start': 85, 'end': 86}, {'word': '55', 'score': 0.32759979367256165, 'entity': 'LABEL_5', 'index': 19, 'start': 87, 'end': 89}, {'word': '##9', 'score': 0.4324667155742645, 'entity': 'LABEL_5', 'index': 20, 'start': 89, 'end': 90}, {'word': '-', 'score': 0.45314016938209534, 'entity': 'LABEL_5', 'index': 21, 'start': 90, 'end': 91}, {'word': 'mile', 'score': 0.4748324751853943, 'entity': 'LABEL_5', 'index': 22, 'start': 91, 'end': 95}, {'word': 'trip', 'score': 0.492055207490921, 'entity': 'LABEL_5', 'index': 23, 'start': 96, 'end': 100}, {'word': 'aboard', 'score': 0.5214760303497314, 'entity': 'LABEL_5', 'index': 24, 'start': 101, 'end': 107}, {'word': 'a', 'score': 0.5448480844497681, 'entity': 'LABEL_5', 'index': 25, 'start': 108, 'end': 109}, {'word': 'campaign', 'score': 0.4928675889968872, 'entity': 'LABEL_5', 'index': 26, 'start': 110, 'end': 118}, {'word': 'train', 'score': 0.359994113445282, 'entity': 'LABEL_5', 'index': 27, 'start': 119, 'end': 124}, {'word': 'from', 'score': 0.4995194673538208, 'entity': 'LABEL_5', 'index': 28, 'start': 125, 'end': 129}, {'word': 'washington', 'score': 0.6212663054466248, 'entity': 'LABEL_5', 'index': 29, 'start': 130, 'end': 140}, {'word': '.', 'score': 0.42734676599502563, 'entity': 'LABEL_5', 'index': 30, 'start': 141, 'end': 142}]
`

2. After the model training is completed, Precision and F-Score are 0.0；
`
05/07/2021 08:51:22 - INFO - __main__ -   *** Evaluate ***
[INFO|trainer.py:510] 2021-05-07 08:51:22,162 >> The following columns in the ev
aluation set  don't have a corresponding argument in ‘BertForTokenClassification
.forward’ and have been ignored: ner, words.
[INFO|trainer.py:2008] 2021-05-07 08:51:22,166 >> ***** Running Evaluation *****
[INFO|trainer.py:2010] 2021-05-07 08:51:22,166 >>   Num examples = 1
[INFO|trainer.py:2013] 2021-05-07 08:51:22,168 >>   Batch size = 8
  0%|                                                    | 0/1 [00:00<?, ?it/s]D
:\Tool\Install\Python\lib\site-packages\seqeval\metrics\v1.py:57: UndefinedMetri
cWarning: Precision and F-score are ill-defined and being set to 0.0 in labels w
ith no predicted samples. Use `zero_division` parameter to control this behavior
.
  _warn_prf(average, modifier, msg_start, len(result))
D:\Tool\Install\Python\lib\site-packages\seqeval\metrics\v1.py:57: UndefinedMetr
icWarning: Precision and F-score are ill-defined and being set to 0.0 due to no
predicted samples. Use `zero_division` parameter to control this behavior.
  _warn_prf(average, modifier, msg_start, len(result))
100%|█████████████████████████████████████
███████| 1/1 [00:00<00:00, 13.69it/s]
[INFO|trainer_pt_utils.py:898] 2021-05-07 08:51:22,351 >> ***** eval metrics ***
**
[INFO|trainer_pt_utils.py:903] 2021-05-07 08:51:22,352 >>   epoch
    =        3.0
[INFO|trainer_pt_utils.py:903] 2021-05-07 08:51:22,352 >>   eval_accuracy
    =        0.8
[INFO|trainer_pt_utils.py:903] 2021-05-07 08:51:22,353 >>   eval_f1
    =        0.0
[INFO|trainer_pt_utils.py:903] 2021-05-07 08:51:22,353 >>   eval_loss
    =     1.1879
[INFO|trainer_pt_utils.py:903] 2021-05-07 08:51:22,354 >>   eval_precision
    =        0.0
[INFO|trainer_pt_utils.py:903] 2021-05-07 08:51:22,354 >>   eval_recall
    =        0.0
[INFO|trainer_pt_utils.py:903] 2021-05-07 08:51:22,355 >>   eval_runtime
    = 0:00:00.11
[INFO|trainer_pt_utils.py:903] 2021-05-07 08:51:22,355 >>   eval_samples
    =          1
[INFO|trainer_pt_utils.py:903] 2021-05-07 08:51:22,361 >>   eval_samples_per_sec
ond =      8.925
`

Is there not enough data set or is there a wrong setting? Thank you.

@sgugger

Comments:
It's just a matter of data: a lot of the words are labelled with "not entity" so the model has a tendency to learn to spit that label for each word, in the absence of more data.