Batch Size error
Hello,

I wanted to use Roberta for Sentence classification on protein sequences which I have converted into sentences. So first I train a tokenizer for my custom vocabulary.

```tokenizer = CharBPETokenizer()
tokenizer.train("bert_vocab.txt",vocab_size=8000,special_tokens=[
    "[CLS]",
    "[SEP]",
    "[UNK]",
    "[MASK]",
])

tokenizer.save_model("EsperBERTo")

from tokenizers.implementations import CharBPETokenizer
from tokenizers.processors import BertProcessing

tokenizer._tokenizer.post_processor = BertProcessing(("[SEP]", tokenizer.token_to_id("[SEP]")), ("[CLS]", tokenizer.token_to_id("[CLS]")),)
print(tokenizer.encode("AAA ATA AKA"))
print(tokenizer.encode("AAA ATA AKA").tokens)

tokenizer.enable_truncation(max_length=512)


import torch
torch.cuda.is_available()

from transformers import RobertaConfig

config = RobertaConfig(
    vocab_size=8000,
    max_position_embeddings=514,
    num_attention_heads=12,
    num_hidden_layers=6,
    type_vocab_size=1,
)

from transformers import RobertaTokenizerFast

tokenizer = RobertaTokenizerFast.from_pretrained("./EsperBERTo", max_len=512)

```
When i try to train the model, i get the error `ValueError: Expected input batch_size (64) to match target batch_size (8192).`

```
model = RobertaForSequenceClassification(config=config)


model.num_parameters()


from transformers import DataCollatorForLanguageModeling

from transformers import LineByLineTextDataset

dataset = LineByLineTextDataset(
    tokenizer=tokenizer,
    file_path="bert_data.txt",
    block_size=64,
)

data_collator = DataCollatorForLanguageModeling(
    tokenizer=tokenizer)

from transformers import Trainer, TrainingArguments

training_args = TrainingArguments(
    output_dir="./EsperBERTo",
    overwrite_output_dir=True,
    num_train_epochs=100,
    per_device_train_batch_size=64,
    save_steps=10_000,
    save_total_limit=2,
)

trainer = Trainer(
    model=model,
    args=training_args,
    data_collator=data_collator,
    train_dataset=dataset,
    prediction_loss_only=True,
)
trainer.train()

trainer.save_model("./EsperBERTo")
```
I understand i do not specify the output labels anywhere in the code but I am yet to find any example which I could follow to figure this. 
It would be great to have all the information relative to your environment, as asked in the template, as well as the full error stack trace so that we may help you.<|||||>```
trainer.train()
  File "/home/bhavay18384/.conda/envs/myenv/lib/python3.7/site-packages/transformers/trainer.py", line 499, in train
    tr_loss += self._training_step(model, inputs, optimizer)
  File "/home/bhavay18384/.conda/envs/myenv/lib/python3.7/site-packages/transformers/trainer.py", line 622, in _training_step
    outputs = model(**inputs)
  File "/home/bhavay18384/.conda/envs/myenv/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/bhavay18384/.conda/envs/myenv/lib/python3.7/site-packages/transformers/modeling_roberta.py", line 357, in forward
    loss = loss_fct(logits.view(-1, self.num_labels), labels.view(-1))
  File "/home/bhavay18384/.conda/envs/myenv/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/bhavay18384/.conda/envs/myenv/lib/python3.7/site-packages/torch/nn/modules/loss.py", line 932, in forward
    ignore_index=self.ignore_index, reduction=self.reduction)
  File "/home/bhavay18384/.conda/envs/myenv/lib/python3.7/site-packages/torch/nn/functional.py", line 2317, in cross_entropy
    return nll_loss(log_softmax(input, 1), target, weight, None, ignore_index, None, reduction)
  File "/home/bhavay18384/.conda/envs/myenv/lib/python3.7/site-packages/torch/nn/functional.py", line 2113, in nll_loss
    .format(input.size(0), target.size(0)))
ValueError: Expected input batch_size (64) to match target batch_size (8192).
```

For my environment I had `pytorch == 1.6` on a Linux based system but while trying to solve this i have mixed up alot of my packages.<|||||>@LysandreJik the issue is still there in `pytorch== 1.7.0`<|||||>Could you please show us the result of running `transformers-cli env`?<|||||>@LysandreJik 
```
- `transformers` version: 3.0.2
- Platform: Linux-3.10.0-693.5.2.el7.x86_64-x86_64-with-centos-7.4.1708-Core
- Python version: 3.7.9
- PyTorch version (GPU?): 1.7.0 (False)
- Tensorflow version (GPU?): 2.3.0 (False)
- Using GPU in script?:yes
- Using distributed or parallel set-up in script?: <
```<|||||>Maybe @sgugger has an idea of what could be going on.<|||||>You're using `DataCollatorForLanguageModeling`, with a model for sequence classification. It can't work as `DataCollatorForLanguageModeling` prepares the labels for language modeling by duplicating the inputs, whereas you should have one label per sentence in your batch.<|||||>@sgugger Thanks for the help. I tried to use `DataCollatorForTokenClassification` but that throws
```
]Traceback (most recent call last):
  File "m1.py", line 122, in <module>
    trainer.train()
  File "/home/bhavay18384/.conda/envs/myenv/lib/python3.7/site-packages/transformers/trainer.py", line 747, in train
    tr_loss += self.training_step(model, inputs)
  File "/home/bhavay18384/.conda/envs/myenv/lib/python3.7/site-packages/transformers/trainer.py", line 1075, in training_step
    loss = self.compute_loss(model, inputs)
  File "/home/bhavay18384/.conda/envs/myenv/lib/python3.7/site-packages/transformers/trainer.py", line 1105, in compute_loss
    return outputs["loss"] if isinstance(outputs, dict) else outputs[0]
  File "/home/bhavay18384/.conda/envs/myenv/lib/python3.7/site-packages/transformers/file_utils.py", line 1338, in __getitem__
    return inner_dict[k]
KeyError: 'loss'
```<|||||>You're doing sequence classification, not token classification. Also `LineByLineDataset` can't be used as it doesn't deal with labels. For doing text classification, you should look at the [run_glue example](https://github.com/huggingface/transformers/blob/master/examples/text-classification/run_glue.py).

Also, we don't use issues to debug user's code, so please switch to the [forum](https://discuss.huggingface.co/) where there is a bigger community of people that will be able to help.