Model does not train when using new BertModel, but does with old BertModel
## 📚 Migration

I am currently working on using Transformers with Snorkel's classification library [https://github.com/snorkel-team/snorkel](https://github.com/snorkel-team/snorkel) (for MTL learning in the future). I currently am trying to troubleshoot why the model is not learning, and so have my experiment set up such that the Snorkel library learns one task, essentially training a BERT model and linear layer.

The code for this experiment can be found at [https://github.com/Peter-Devine/test_cls_snorkel_mtl]( https://github.com/Peter-Devine/test_cls_snorkel_mtl ). To run it, you will need torch, snorkel, numpy, pytorch_pretrained_bert and transformers.

My problem is as follows.
When I run the code in `test_cls_snorkel_mtl/tutorials/ISEAR_pretrain_tutorial.py`, my code runs fine and the model's validation accuracy scores are good. This is because I am using the old pytorch_pretrained_bert BertModel in `test_cls_snorkel_mtl/modules/bert_module.py`. If you uncomment line 6 of `test_cls_snorkel_mtl/modules/bert_module.py` and use the new transformers BertModel, then running `test_cls_snorkel_mtl/tutorials/ISEAR_pretrain_tutorial.py` will result in a model that never converges and bad validation accuracy.

From reading the code on Snorkel, I cannot seem to find the reason as to why this would be. What are the major changes in training a model between versions of pytorch_pretrained_bert and transformers. Do back-passes etc. work the same way in both models?

Thanks
You can check the two migration guides, they explain all the differences:
- https://github.com/huggingface/transformers#Migrating-from-pytorch-transformers-to-transformers
- https://github.com/huggingface/transformers#migrating-from-pytorch-pretrained-bert-to-transformers <|||||>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.
