LibtorchDetection icon indicating copy to clipboard operation
LibtorchDetection copied to clipboard

为啥训练完成后显存没有释放

Open kc-w opened this issue 3 months ago • 3 comments

kc-w avatar Mar 14 '24 12:03 kc-w

torch 的显存最好手动释放吧

AllentDan avatar Mar 15 '24 01:03 AllentDan

我用线程跑的训练,训练结束后内存和显存都没有释放,在网上也查了下用cudaDeviceReset()可以释放,但是调用过再次训练就没法加载模型了,像torch.cuda.empty_cache()这样的函数,libtroch里也没有,作者有什么好办法吗?

kc-w avatar Mar 15 '24 02:03 kc-w

用进程吧,torch 的显存不容易释放干净

AllentDan avatar Mar 15 '24 03:03 AllentDan