In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you what to do when CUDA runs out of memory. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The editor repeated that the boss project found that GPU could not run, and made the following error:
RuntimeError: CUDA out of memory.
It seems that the simplest and roughest way is to reduce batch_size, slow is more than a little bit, but at least can run!
Add: Pytorch GPU has plenty of memory but shows out of memory solution
When testing a pytorch code, it shows that there is not enough memory, but the network framework is obviously very simple, and there is no problem running with CPU, but GPU keeps prompting out of memory.
Find a lot of methods on the Internet are not working, and finally I think it may be the pytorch version of the problem, the original pytorch version is 0.4.1, so I uninstalled this version, and then installed pytorch2.1.0, the program can miraculously run, there will be no more OOM prompts. Although we don't know the exact reason, let's mark it first.
The specific process is as follows:
Uninstall the old version of pytorch:
Conda uninstall pytorch
To install pytorch2.1.0, according to the method on the official website, my CUDA version is 9.0:
Conda install pytorch torchvision cudatoolkit=9.0-c pytorch
The great task has been completed!
Thank you for reading! This is the end of this article on "what to do with CUDA out of memory". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
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
© 2024 shulou.com SLNews company. All rights reserved.