当前位置:网站首页>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
边栏推荐
- 严守工期,确保质量,这家AI数据标注公司做到了!
- 高并发介绍及应对
- 【板栗糖GIS】arcscene—如何做出有高度的高程图
- World Environment Day | Chow Tai Fook serves wholeheartedly to promote carbon reduction and environmental protection
- 剑指 Offer II 099. 最小路径之和-双百代码
- The kth largest element in the [leetcode] array [215]
- Higher order operation of bits
- [LeetCode] 数组中的第K个最大元素【215】
- Go multithreaded data search
- Kubernetes uses the host name to allocate the pod on the specified node
猜你喜欢

Jatpack------LiveData

Wait to solve the zombie process
![[Solved] Splunk: Cannot get username when all users are selected“](/img/13/1e824c8005701e21fc5b4e73308d53.png)
[Solved] Splunk: Cannot get username when all users are selected“

Performance optimization - rigorous mode

最小生成树 Minimum Spanning Tree

Comprehensively analyze the logic of the shared purchase business model? How sharing purchase empowers Enterprises

【板栗糖GIS】arcmap—如何批量修改注记要素的字体,颜色,大小等
![[羊城杯2020]easyphp](/img/12/da28f738e50e625b0a66a94af3703d.png)
[羊城杯2020]easyphp

Analyse des données dossiers d'apprentissage - - analyse simple de la variance à facteur unique avec Excel

严守工期,确保质量,这家AI数据标注公司做到了!
随机推荐
严守工期,确保质量,这家AI数据标注公司做到了!
杰理之内置关机电流 1.2uA,之后不能长按开机【篇】
Boot actuator - Prometheus use
Lc173. Binary search tree iterator
Analyse des données dossiers d'apprentissage - - analyse simple de la variance à facteur unique avec Excel
Qt QScrollArea
uniapp微信登录返显用户名和头像
Dahua cloud native load balancing article - the passenger flow of small restaurants has increased
Hanging mirror security won four global infosec awards on rsac2022
How can I use knockout's $parent/$root pseudovariables from inside a . computed() observable?
QT qsplitter splitter
数据标注典型案例,景联文科技如何助力企业搭建数据方案
LeetCode 968. 监控二叉树
go 多线程数据搜索
全面解析分享购商业模式逻辑?分享购是如何赋能企业
Go multithreaded data search
高并发介绍及应对
Jerry's modification does not require long press the boot function [chapter]
最小生成树 Minimum Spanning Tree
Jerry's prototype has no touch, and the reinstallation becomes normal after dismantling [chapter]