In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
How to solve the No module named models in PyTorch, I believe that many inexperienced people do not know what to do. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Hardware and software environment ubuntu 18.04 64bitanaconda with 3.7nvidia gtx 1070Ticuda 10.1pytorch 1.5 problem
Model files trained using the pytorch deep learning framework and used in other projects often encounter the following errors
File "/ home/xugaoxiang/anaconda3/envs/torchTest/lib/python3.7/site-packages/torch/serialization.py", line 593, in load return _ legacy_load (opened_file, map_location, pickle_module, * * pickle_load_args) File "/ home/xugaoxiang/anaconda3/envs/torchTest/lib/python3.7/site-packages/torch/serialization.py", line 773, in _ legacy_load result = unpickler.load () ModuleNotFoundError: No module named 'models' solution
In fact, this problem is mentioned in the official document of pytorch, as follows
The above method is recommended. When executing torch.save and torch.load, all the parameters of the model are operated, so it is very convenient to transplant.
The following method is for the entire model, when training the model, the local class and directory structure will be written to the model. Many open source projects are saved in this way after model training, so when you use such a model in your own project, you will often encounter the above problems. The solution is to maintain the necessary structure of the original project in your project, such as the corresponding class and modules.
After reading the above, have you mastered how to solve the No module named models in PyTorch? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un