Loading Torch7 trained models (.t7) in PyTorch
The correct function is load_lua
:
from torch.utils.serialization import load_lua
x = load_lua('x.t7')
As of PyTorch 1.0 torch.utils.serialization
is completely removed. Hence no one can import models from Lua Torch into PyTorch anymore. Instead, I would suggest installing PyTorch 0.4.1 through pip
in a conda
environment (so that you can remove it after this) and use this repo to convert your Lua Torch model to PyTorch model, not just the torch.nn.legacy
model that you cannot use for training. Then use PyTorch 1.xx to do whatever with it. You can also train your converted Lua Torch models in PyTorch this way :)