Solution for ModuleNotFoundError: No module named 'torch.utils.serialization'

content

1. Problems

Second, the cause of analysis

3. Solutions


1. Problems

ModuleNotFoundError: No module named 'torch.utils.serialization'

Second, the cause of analysis

It may be that the Pytorch version is too new


3. Solutions

1. Install an older version of Pytorch

2. Replace with a new version of the function: torchfile

(1) Install torchfile

pip install torchfile

(2) Change from torch.utils.serialization import load_lua to import torchfile

(3) Change load_lua to torchfile.load

Published 129 original articles , received 1105 likes , visited 1.69 million+

Related Posts