当前位置:网站首页>Pytorch training CPU usage continues to grow (Bug)
Pytorch training CPU usage continues to grow (Bug)
2022-07-02 23:00:00 【zyr_ freedom】
CPU Memory continues to increase during training , rise , Use gc.collect() Invalid
1. Use
@profile You can see cpu Occupancy
2. Check for mistakes
python Content and tensor Whether there is a direct exchange of content, focus on checking , Focus on the accumulated places , This will lead to memory leakage
Example
such as acc += list(correctness) To the left of the equal sign is python Native list,correctness yes torch.FloatTensor
Switch to acc += list(np.array(correctness.cpu()))
reason :list And tensor There is a memory leak problem in mutual transfer , If you need to switch , Should be tensor from cuda-->cpu-->numpy.array
Example
total_loss +=loss1------->total_loss +=loss1.item() (.item() Is to get the element value in an element tensor )
Forget when reasoning torch.no_grad() Cause gradient accumulation
边栏推荐
- go 条件变量
- 數據分析學習記錄--用EXCEL完成簡單的單因素方差分析
- 情感对话识别与生成简述
- Share 10 JS closure interview questions (diagrams), come in and see how many you can answer correctly
- 【板栗糖GIS】global mapper 如何通过dsm批量制作贴地等高线
- [LeetCode] 存在重复元素【217】
- The kth largest element in the [leetcode] array [215]
- Jerry's built-in short press and long press, no matter how long it is, it is a short press [chapter]
- P7072 [CSP-J2020] 直播获奖
- Distributed monitoring system ZABBIX
猜你喜欢
Analyse des données dossiers d'apprentissage - - analyse simple de la variance à facteur unique avec Excel
加油站[问题分析->问题转换->贪心]
Jatpack------LiveData
Jatpack------LiveData
Motivation du Protocole de chiffrement avancé AES
Gas station [problem analysis - > problem conversion - > greed]
地方经销商玩转社区团购模式,百万运营分享
Dahua cloud native load balancing article - the passenger flow of small restaurants has increased
mysql重置密码,忘记密码,重置root密码,重置mysql密码
泛型与反射,看这篇就够了
随机推荐
用sentinel熔断比例阈值改不了,设置慢调用比例没效果
小鹏P7出事故,安全气囊未弹出,这正常吗?
Jerry's prototype has no touch, and the reinstallation becomes normal after dismantling [chapter]
[chestnut sugar GIS] how does global mapper batch produce ground contour lines through DSM
DTM distributed transaction manager PHP collaboration client V0.1 beta release!!!
海思3559万能平台搭建:在截获的YUV图像上画框
移动端 1px 像素兼容性问题,实现1px 边框
Qt QProgressBar详解
性能优化----严苛模式
mysql重置密码,忘记密码,重置root密码,重置mysql密码
Jerry's prototype will trigger shutdown after multiple touches [chapter]
1px pixel compatibility of mobile terminal, 1px border
go 多线程数据搜索
【喜欢的诗词】好了歌
go 条件变量
手写ORM(对象关系映射)增删改查
【洛谷P1541】乌龟棋【DP】
[leetcode] reverse string [344]
数据分析学习记录(二)---响应曲面法及Design-Expert的简单使用
Comprehensively analyze the logic of the shared purchase business model? How sharing purchase empowers Enterprises