Potential bug with gradient clipping when using gradient accumulation in examples
## ❓ Questions & Help

Hi developpers,

Thanks for the awesome package. I have a question related to the recent major from pytorch_pretrained_bert to pytorch_transformers.

Gradient clipping used to be done inside the optimizer BertAdam and is now done at the same time as gradient computation in `run_squad.py` : https://github.com/huggingface/pytorch-transformers/blob/7729ef738161a0a182b172fcb7c351f6d2b9c50d/examples/run_squad.py#L156

It seems to me like the first accumulated gradients might get clipped several times hence giving more weight to last accumulated gradients : 

As an example of my thought here is what happens if we compare what we get if we clip to 1 at each accumulation step instead of at the end of the accumulation for the two gradients [2,0] and [0,2]:

```python
In [1]: import torch
   ...: from torch.nn.utils import clip_grad_norm_
   ...: from torch.autograd import Variable
   ...: 
   ...: x = Variable(torch.FloatTensor([[0],[0]]), requires_grad=True)
   ...: 
   ...: grad1 = torch.FloatTensor([[2],[0]])
   ...: grad2 = torch.FloatTensor([[0],[2]])
   ...: 
   ...: x.grad = grad1
   ...: clip_grad_norm_(x, 1)
   ...: print(x.grad)
   ...: 
   ...: x.grad += grad2
   ...: clip_grad_norm_(x, 1)
   ...: print(x.grad)
   ...: 
   ...: grad1 = torch.FloatTensor([[2],[0]])
   ...: grad2 = torch.FloatTensor([[0],[2]])
   ...: 
   ...: x.grad = grad1 + grad2
   ...: clip_grad_norm_(x, 1)
   ...: print(x.grad)
   ...: 
   ...: 
tensor([[1.0000],
        [0.0000]])
tensor([[0.4472],
        [0.8944]])
tensor([[0.7071],
        [0.7071]])```

We can see that clipping  at each step biased gradient towards the gradient of the second batch:
`python tensor([[0.4472], [0.8944]])` 
Instead of getting the balanced expected result : `python tensor([[0.7071], [0.7071]])` 

So either I missed something or I think the fix would be to simply move gradient clipping before the call to the optimizer
Hi, indeed we could move the gradient clipping just before the call to the optimizer.
Do you want to send a PR to fix that on `run_squad` and `run_glue`?<|||||>Hi, was this ever implemented? I think it makes the most sense to clip right before an optimizer step. Right now it's implemented in two different ways in [run_lim_finetuning](https://github.com/huggingface/transformers/blob/master/examples/run_lm_finetuning.py) and [run_glue](https://github.com/huggingface/transformers/blob/master/examples/run_glue.py)<|||||>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.
