Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loading Torch7 trained models (.t7) in PyTorch

I am using Torch7 library for implementing neural networks. Mostly, I rely on pre-trained models. In Lua I use torch.load function to load a model saved as torch .t7 file. I am curious about switching to PyTorch( http://pytorch.org) and I read the documents. I couldn't find any information regarding the mechanisms to load a pre-trained model. The only relevant information I was able to find is this page:http://pytorch.org/docs/torch.html

But the function torch.load described in the page seems to load a file saved with pickle. If someone has additional information on loading .t7 models in PyTorch, please share it here.

like image 338
Arul Avatar asked Jan 25 '17 20:01

Arul


1 Answers

The correct function is load_lua:

from torch.utils.serialization import load_lua

x = load_lua('x.t7')
like image 103
elyase Avatar answered Sep 19 '22 18:09

elyase