Problem loading Torch GPU-pretrained model on CPU

I am new to PyTorch and I am currently working on an image classification project, in which I need to use ResNeXt-50 provided by FB.
I downloaded the repository and tried to load the model using ‘load_lua’ command (.t7 extension), but it gives me an error:

T7ReaderException: don’t know how to deserialize Lua class torch.CudaTensor. If you want to ignore this
error and load this object as a dict, specify unknown_classes=True in reader’s constructor

As suggested, I tried using ‘unknown_classes = Ture’, but this in return results in

T7ReaderException: unknown type id 288432214. The file may be corrupted.

I suspect there may be two main problems, namely:

  • I am using laptop, which does not have a GPU (only Intel card), therefore when I tried to install CUDA I encountered problems, which prevented me from finishing installation.
  • The model was trained in Torch using GPU and I would like to load it using only CPU.
    I also tried to convert torch to pytorch files, but all scripts I found use the same methods ‘load_lua’, which results in the aforementioned errors.

Can you give me some hints, first of all, if the model can be loaded on my machine at all. If possible, what steps I should try? Maybe enforce CUDA installation somehow even though I do not have GPU?
I have been googling the problems for whole 2 days and I could not find any solution.

1 Like


Aren’t these resnet models the same as the ones provided in torchvision here ?

import torchvision
resnet50 = torchvision.models.resnet50(pretrained=True)
# There you have it !

I believe, the FB implementation is a little bit different compared to the original ResNet, but for the time being I used your suggestion and it does work! Thanks a lot!

Hi! I have exactly the same problem. But, unfortunately, the library preobrazhennya models PyTorch not my model. I want to read these models:

Operating system: Windows 7, x64; GPU does not support CUDA. The main goal is to obtain weights from the EDSR_x4.t7 model for later use in my implementation on pure C#.


Unfortunately I did not manage to load the FB model. I used the model built-in that you can find in PyTorch.
Here is a nice repo with pre-trained model. Maybe you will find yours (I did not check if there is the one you are looking for).

Thank you very much, but there’s no model. In addition, I would like to know how to solve such a problem.