In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.