configuration of the optimizer 
Author: antgr
Pull request: no
Labels: name: wontfix

## 📚 Migration

<!-- Important information -->

Model I am using (Bert, XLNet....):
Bert

Language I am using the model on (English, Chinese....):
English

The problem arise when using:
* [ ] the official example scripts: (give details)
* [x] my own modified scripts: (give details)

The tasks I am working on is:
* [ ] an official GLUE/SQUaD task: (give the name)
* [x] my own task or dataset: (give details)
Sequence labeling task

Details of the issue:
So, what is the issue:
I have a code that works with ```pytorch-pretrained-bert==0.4.0```
with the following setup for the optimizer:
```
FULL_FINETUNING = True
if FULL_FINETUNING:
    param_optimizer = list(model.named_parameters())
    no_decay = ['bias', 'gamma', 'beta']
    optimizer_grouped_parameters = [
        {'params': [p for n, p in param_optimizer if not any(nd in n for nd in no_decay)],
         'weight_decay_rate': 0.01},
        {'params': [p for n, p in param_optimizer if any(nd in n for nd in no_decay)],
         'weight_decay_rate': 0.0}
    ]
else:
    param_optimizer = list(model.classifier.named_parameters())
    optimizer_grouped_parameters = [{"params": [p for n, p in param_optimizer]}]
optimizer = Adam(optimizer_grouped_parameters, lr=3e-5)
```
With this configuration I have an f1-score near to  68% from the beginning.

But with transformers, and migrating to something like (taken from documentation):
```
um_training_steps = 1000
num_warmup_steps = 100
warmup_proportion = float(num_warmup_steps) / float(num_training_steps)  # 0.1
#optimizer = AdamW(model.parameters(), lr=lr, correct_bias=False)  # To reproduce BertAdam specific behavior set correct_bias=False
scheduler = get_linear_schedule_with_warmup(optimizer, num_warmup_steps=num_warmup_steps, num_training_steps=num_training_steps)
```
I stay in an  f1-score near to 14%.
How can I simulate the former functionality to get back to to the better f1-score?
 
The changes between the two versions are
```
> num_training_steps = 1000
> num_warmup_steps = 100
> warmup_proportion = float(num_warmup_steps) / float(num_training_steps)  # 0.1
> #optimizer = AdamW(model.parameters(), lr=lr, correct_bias=False)  # To reproduce BertAdam specific behavior set correct_bias=False
> scheduler = get_linear_schedule_with_warmup(optimizer, num_warmup_steps=num_warmup_steps, num_training_steps=num_training_steps)
> 
181c199
< epochs = 50
---
> epochs = 10
195c213
<                      attention_mask=b_input_mask, labels=b_labels)
---
>                      attention_mask=b_input_mask, labels=b_labels)[0]
204a223,224
>         #optimizer.step()
>         torch.nn.utils.clip_grad_norm_(model.parameters(), max_grad_norm)  # Gradient clipping is not in AdamW anymore (so you can use amp without issue)
205a226,227
>         scheduler.step()
> 
220c242
<                                   attention_mask=b_input_mask, labels=b_labels)
---
>                                   attention_mask=b_input_mask, labels=b_labels)[0]
222c244
<                            attention_mask=b_input_mask)
---
>                            attention_mask=b_input_mask)[0]
276d297
```
Also in the documentation https://huggingface.co/transformers/migration.html
suggests the following order
```
    scheduler.step()
    optimizer.step()
```
but that raises a warning from latest version of pytorch which wants the opposite order.


<!-- A clear and concise description of the migration issue. If you have code snippets, please provide it here as well. -->

## Environment

* OS:
* Python version: 3.6
* PyTorch version: 1.3.1
* PyTorch Transformers version (or branch): latest
* Using GPU ? yes
* Distributed of parallel setup ? No
* Any other relevant information:

## Checklist

- [x] I have read the migration guide in the readme.
- [ ] I checked if a related official extension example runs on my machine.


<!-- Add any other context about the problem here. -->


Comments:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.