How to convert a tf2 pre-trained model to pytorch model?
## ❓ Questions & Help

<!-- A clear and concise description of the question. -->
I have trained a pre-trained model from scratch using a tensorflow 2.0 official script (run_pretraining.py).
https://github.com/tensorflow/models/tree/master/official/nlp/bert

My question is how to convert the pre-trained model to pytorch model?
Thanks in advance.
Have you ever tried [convert_bert_original_tf_checkpoint_to_pytorch.py](https://github.com/huggingface/transformers/blob/1ab8dc44b3d84ed1894f5b6a6fab58fb39298fc7/transformers/convert_bert_original_tf_checkpoint_to_pytorch.py)?

> ##  Questions & Help
> I have trained a pre-trained model from scratch using a tensorflow 2.0 official script (run_pretraining.py).
> https://github.com/tensorflow/models/tree/master/official/nlp/bert
> 
> My question is how to convert the pre-trained model to pytorch model?
> Thanks in advance.<|||||>Thanks for your comment.

This script is for tensorflow 1.0.
https://github.com/google-research/bert

The weight names are different between tf 1.0 and 2.0, and this script does not work for a tf2 pre-trained model.<|||||>If you have enough time, you can implement it, open a PR and share your source code with us

> Thanks for your comment.
> 
> This script is for tensorflow 1.0.
> https://github.com/google-research/bert
> 
> The weight names are different between tf 1.0 and 2.0, and this script does not work for a tf2 pre-trained model.<|||||>OK, I will try it.

As a tentative workaround I will ask how to convert a tf2 pre-trained model to a tf1 model in the official tensorflow BERT project.<|||||>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.
<|||||>@tomohideshibata did you ever succeed in converting your model to pytorch or tf1?

edit: seems it was added already to `transformers` in #5791<|||||>No.
Thanks for the information.