How to transfer pretained model from Tensorflow (.ckpt) to PyTorch?

How I can transfer pertrained models in Tensorflow such as .ckpt file to Pytorch?

I am not sure if this is possible directly from ckpt files. What I and my research collaborators do/did is just rewriting our old TensorFlow models in PyTorch and then importing the weights. But that’s probably the most tedious solution.

There are different tools like Microsoft’s MMdnn ( that might be able to do this. I think the optimal way would be via ONNX, but I think the TensorFlow one is still not very stable ( In the main tutorials repo,, the TensorFlow export and PyTorch import are both listed as “coming soon” though :).