No module named '__torch__'

In python3.7 and windows10, pytorch 1.5, I saved my model
I loaded

import torch
model = torch.load(‘D:\CR_DOWN\CRAFT-pytorch-master\CRAFT-pytorch-master\’)

but… I got a error of
No module named ‘torch
why I got this error??

ModuleNotFoundError Traceback (most recent call last)
----> 1 model = torch.load(‘D:\CR_DOWN\CRAFT-pytorch-master\CRAFT-pytorch-master\’)

~\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\ in load(f, map_location, pickle_module, **pickle_load_args)
583 return torch.jit.load(opened_file)
–> 584 return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
585 return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)

~\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\ in _load(zip_file, map_location, pickle_module, **pickle_load_args)
840 unpickler = pickle_module.Unpickler(data_file, **pickle_load_args)
841 unpickler.persistent_load = persistent_load
–> 842 result = unpickler.load()
844 return result

ModuleNotFoundError: No module named ‘torch


Did you saved that file with a different version of pytorch by any chance? Especially a more recent version than the one you use for loading?

I’ve recognized that the model what i trying to convert to mobile is actually not pytorch model…
(it was python function name, not a pytorch model)
I changed the model correctly, and it worked!
Thank you.

1 Like