自学内容网 自学内容网

【踩坑随笔】Tensorflow-GPU训练踩坑

一个无语的坑,4060单卡训练,8G内存本来就不够,还没开始训练就已经爆内存了,但是居然正常跑完了训练,然后一推理发现结果就是一坨。。。往回翻日志才发现原来中间有异常。

首先解决第一个问题:Could not load dynamic library 'cupti64_112.dll'
在这里插入图片描述
解决方法参考TensorFlow训练中保存tensorboard中cupti丢失问题解决,总结一下就是找到cupti64_2020.2.1.dll复制到cuda安装路径的bin目录下,并重命名为缺的这个cupti64_112.dll

最坑的来了,OOM了但是还是能正常训练完,但是结果保存的权重必然是有问题的

UserWarning: Converting sparse IndexedSlices(IndexedSlices(indices=Tensor("training/SGD/gradients/gradients/roi_align_classifier/concat_grad/sub:0", shape=(None,), dtype=int32), values=Tensor("training/SGD/gradients/gradients/roi_align_classifier/concat_grad/GatherV2_2:0", shape=(None, 7, 7, 256), dtype=float32), dense_shape=Tensor("training/SGD/gradients/gradients/roi_align_classifier/concat_grad/Shape:0", shape=(4,), dtype=int32))) to a dense Tensor of unknown shape. This may consume a large amount of memory.
  warnings.warn(

在这里插入图片描述
试了改小batch_size并没有用。。。。暂时没找到解决方法,初步断定就是显存不够,但是换了24G显存的卡出了新问题,直接卡在epoch1,不报错也不继续,后台程序挂起,GPU利用率为0,试遍了都没找到解决方案,解决了再来更新。。。。

在这里插入图片描述
在这里插入图片描述
找到了win11下的解决方案
使用GPU训练tensorflow/keras模型,Memory-Usage占用高,GPU-Util利用率低。提升GPU-Util利用率,提升模型训练速度

在这里插入图片描述
利用率终于不是0了!但是好像还是没解决根本问题,运行结果跟之前一模一样。。。。


原文地址:https://blog.csdn.net/qq_44894943/article/details/143025357

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!