KeyError: 'labels' in distill_classifier.py
Author: adamFinastra
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.1
- Platform: Darwin-19.6.0-x86_64-i386-64bit
- Python version: 3.7.6
- PyTorch version (GPU?): 1.8.1 (False)
- Tensorflow version (GPU?): 2.2.0 (False)
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No


### Issue 
I am trying to run the distill_classifier.py script from transformers/examples/research_projects/zero-shot-distillation/ with my own text data set and labels on the roberta-large-mnli model. There are a few hundred rows of text and 13 class labels. I am running the following in a cell of my notebook:

```
!python transformers/examples/research_projects/zero-shot-distillation/distill_classifier.py \
--data_file ./distill_data/train_unlabeled.txt \
--class_names_file ./distill_data/class_names.txt \
--teacher_name_or_path roberta-large-mnli \
--hypothesis_template "This text is about {}." \
--output_dir ./my_student/distilled
```

The script starts to run but after a short while I receive the following error: 

```
Trainer is attempting to log a value of "{'Science': 0, 'Math': 1, 'Social Studies': 2, 'Language Arts': 3, 'Statistics': 4, 'Calculus': 5, 'Linear Algebra': 6, 'Probability': 7, 'Chemistry': 8, 'Biology': 9, 'Supply chain management': 10, 'Economics': 11, 'Pottery': 12}" 
for key "label2id" as a parameter. 
MLflow's log_param() only accepts values no longer than 250 characters so we dropped this attribute.
 0%|                                                     | 0/7 [00:00<?, ?it/s]Traceback (most recent call last):
  File "transformers/examples/research_projects/zero-shot-distillation/distill_classifier.py", line 338, in <module>
    main()
  File "transformers/examples/research_projects/zero-shot-distillation/distill_classifier.py", line 328, in main
    trainer.train()
  File "/opt/anaconda3/lib/python3.7/site-packages/transformers/trainer.py", line 1272, in train
    tr_loss += self.training_step(model, inputs)
  File "/opt/anaconda3/lib/python3.7/site-packages/transformers/trainer.py", line 1734, in training_step
    loss = self.compute_loss(model, inputs)
  File "transformers/examples/research_projects/zero-shot-distillation/distill_classifier.py", line 119, in compute_loss
    target_p = inputs["labels"]
  File "/opt/anaconda3/lib/python3.7/site-packages/transformers/tokenization_utils_base.py", line 231, in __getitem__
    return self.data[item]
KeyError: 'labels'
  0%|                                                     | 0/7 [00:01<?, ?it/s]
```
I have re-examined my labels files and am exactly following this guide for distill_classifier.py 

https://colab.research.google.com/drive/1mjBjd0cR8G57ZpsnFCS3ngGyo5nCa9ya?usp=sharing&utm_campaign=Hugging%2BFace&utm_medium=web&utm_source=Hugging_Face_8#scrollTo=ECt06ndcnpyb  

Any help would be appreciated to distill!  

**Edit:** Updated torch to latest version and receiving the same error. I reduced number of classes from 24 to 13 and still have this issue. When I print inputs in the compute loss function it looks like there is no key for labels: 

```
{'attention_mask': tensor([[1, 1, 1,  ..., 0, 0, 0],
        [1, 1, 1,  ..., 0, 0, 0],
        [1, 1, 1,  ..., 0, 0, 0],
        ...,
        [1, 1, 1,  ..., 0, 0, 0],
        [1, 1, 1,  ..., 0, 0, 0],
        [1, 1, 1,  ..., 0, 0, 0]]), 'input_ids': tensor([[ 101, 1999, 2262,  ...,    0,    0,    0],
        [ 101, 4117, 2007,  ...,    0,    0,    0],
        [ 101, 2130, 2295,  ...,    0,    0,    0],
        ...,
        [ 101, 1999, 2760,  ...,    0,    0,    0],
        [ 101, 2057, 6614,  ...,    0,    0,    0],
        [ 101, 2057, 1521,  ...,    0,    0,    0]])}
```

Is there an additional parameter that is needed to assign the labels? 

**Edit 2:** Just let the colab notebook "Distilling Zero Shot Classification.ipynb" run for a few hours and am receiving the same error with the agnews dataset. It looks like the code in the colab notebook might have an incompatibility with some other files possibly. 

**Edit 3:** I have changed datasets and reduced to 3 classes and tried to add the label_names argument 

`--label_names ["Carbon emissions", "Energy efficiency", "Water scarcity"]
`

my ./distill_data/class_names.txt file looks like: 

```
Carbon Emissions
Energy Efficiency 
Water Scarcity 
```

and am still facing the same error. 

### Who can help
@LysandreJik
@sgugger
@joeddav 


Comments:
I am facing the same issue and cannot run the google colab examples either. Any help is appreciated! 

@joeddav was there a specific point in time to clone the repo from to get the scripts to run or anything recent that has changed which might have broken the code?

Experienced the same issue with labels trained on a custom dataset.

## Environment info
torch                       1.8.1+cu111
tqdm                        4.49.0
transformers                4.5.1
Python 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)]
Windows-10-10.0.17763-SP0

## Issue

Executing this cell:
```
!python transformers/examples/research_projects/zero-shot-distillation/distill_classifier.py \
--data_file email.txt \
--class_names_file class_names.txt \
--hypothesis_template "This text is about {}." \
--student_name_or_path distilbert-base-uncased \
--output_dir ./distilbert-base-uncased-notino-student
```


I'm getting this output:
```
06/09/2021 15:12:04 - WARNING - __main__ -   Process rank: -1, device: cuda:0, n_gpu: 3distributed training: False, 16-bits training: False
06/09/2021 15:12:04 - INFO - __main__ -   Training/evaluation parameters DistillTrainingArguments(output_dir='./distilbert-base-uncased-notino-student', overwrite_output_dir=False, do_train=True, do_eval=True, do_predict=False, evaluation_strategy=<IntervalStrategy.NO: 'no'>, prediction_loss_only=False, per_device_train_batch_size=32, per_device_eval_batch_size=128, per_gpu_train_batch_size=None, per_gpu_eval_batch_size=None, gradient_accumulation_steps=1, eval_accumulation_steps=None, learning_rate=5e-05, weight_decay=0.0, adam_beta1=0.9, adam_beta2=0.999, adam_epsilon=1e-08, max_grad_norm=1.0, num_train_epochs=1.0, max_steps=-1, lr_scheduler_type=<SchedulerType.LINEAR: 'linear'>, warmup_ratio=0.0, warmup_steps=0, logging_dir='runs\\Jun09_15-12-04_dcvmdwhanl03', logging_strategy=<IntervalStrategy.STEPS: 'steps'>, logging_first_step=False, logging_steps=500, save_strategy=<IntervalStrategy.STEPS: 'steps'>, save_steps=500, save_total_limit=0, no_cuda=False, seed=42, fp16=False, fp16_opt_level='O1', fp16_backend='auto', fp16_full_eval=False, local_rank=-1, tpu_num_cores=None, tpu_metrics_debug=False, debug=False, dataloader_drop_last=False, eval_steps=500, dataloader_num_workers=0, past_index=-1, run_name='./distilbert-base-uncased-notino-student', disable_tqdm=False, remove_unused_columns=True, label_names=None, load_best_model_at_end=False, metric_for_best_model=None, greater_is_better=None, ignore_data_skip=False, sharded_ddp=[], deepspeed=None, label_smoothing_factor=0.0, adafactor=False, group_by_length=False, length_column_name='length', report_to=['tensorboard', 'wandb'], ddp_find_unused_parameters=None, dataloader_pin_memory=True, skip_memory_metrics=False, mp_parameters='')

...

100%|##########| 128069/128069 [00:47<00:00, 2710.05ex/s]
[INFO|trainer.py:490] 2021-06-09 18:27:26,719 >> The following columns in the training set  don't have a corresponding argument in `DistilBertForSequenceClassification.forward` and have been ignored: text.
[INFO|trainer.py:1013] 2021-06-09 18:27:27,005 >> ***** Running training *****
[INFO|trainer.py:1014] 2021-06-09 18:27:27,011 >>   Num examples = 128069
[INFO|trainer.py:1015] 2021-06-09 18:27:27,016 >>   Num Epochs = 1
[INFO|trainer.py:1016] 2021-06-09 18:27:27,022 >>   Instantaneous batch size per device = 32
[INFO|trainer.py:1017] 2021-06-09 18:27:27,028 >>   Total train batch size (w. parallel, distributed & accumulation) = 96
[INFO|trainer.py:1018] 2021-06-09 18:27:27,034 >>   Gradient Accumulation steps = 1
[INFO|trainer.py:1019] 2021-06-09 18:27:27,040 >>   Total optimization steps = 1335
[INFO|integrations.py:586] 2021-06-09 18:27:27,791 >> Automatic Weights & Biases logging enabled, to disable set os.environ["WANDB_DISABLED"] = "true"
wandb: Currently logged in as: dbs700 (use `wandb login --relogin` to force relogin)
wandb: wandb version 0.10.31 is available!  To upgrade, please run:
wandb:  $ pip install wandb --upgrade
wandb: Tracking run with wandb version 0.10.30
wandb: Syncing run ./distilbert-base-uncased-notino-student
wandb:  View project at https://wandb.ai/dbs700/huggingface
wandb:  View run at https://wandb.ai/dbs700/huggingface/runs/14c4hinu
wandb: Run data is saved locally in C:\Users\dmitrii.storozhenko\wandb\run-20210609_182747-14c4hinu
wandb: Run `wandb offline` to turn off syncing.

  0%|          | 0/1335 [00:00<?, ?it/s]Traceback (most recent call last):
  File "transformers/examples/research_projects/zero-shot-distillation/distill_classifier.py", line 338, in <module>
    main()
  File "transformers/examples/research_projects/zero-shot-distillation/distill_classifier.py", line 328, in main
    trainer.train()
  File "C:\Users\dmitrii.storozhenko\Anaconda3\lib\site-packages\transformers\trainer.py", line 1120, in train
    tr_loss += self.training_step(model, inputs)
  File "C:\Users\dmitrii.storozhenko\Anaconda3\lib\site-packages\transformers\trainer.py", line 1524, in training_step
    loss = self.compute_loss(model, inputs)
  File "transformers/examples/research_projects/zero-shot-distillation/distill_classifier.py", line 119, in compute_loss
    target_p = inputs["labels"]
KeyError: 'labels'
wandb: Waiting for W&B process to finish, PID 5992
wandb: Program failed with code 1.  Press ctrl-c to abort syncing.
```

Hi, sorry for the slow response. This is due to [a breaking change in the Datasets API](https://github.com/huggingface/datasets/releases/tag/1.6.2). I'll need to update the script accordingly. In the meantime, use datasets <= 1.6.1 and that should solve the problem.

That did the trick!