bshillingford / python-torchfile

Deserialize Lua torch-serialized objects from Python
BSD 3-Clause "New" or "Revised" License
216 stars 25 forks source link

How to convert .t7 file to .h5 #16

Closed MounirB closed 5 years ago

MounirB commented 5 years ago

Hello, Can you tell me how can I convert a .t7 file that is readable thanks to your script to a .h5 file so that I can work on it on Keras ?

bshillingford commented 5 years ago

Sorry, that's not straightforward at all. A quick look here looks like a converter doesn't exist: https://github.com/ysh329/deep-learning-model-convertor

You might be able to try loading the lua torch model from PyTorch, then using the Keras converter in the link above. If the model is simple enough, you could perhaps attempt doing it manually (i.e. regenerate the modules and copy the weights), but it'll still be a pain.