RUCAIBox / RecBole

A unified, comprehensive and efficient recommendation library
https://recbole.io/
MIT License
3.37k stars 606 forks source link

在训练的每一轮结束后释放显存缓冲区 #2044

Open xderui opened 4 months ago

xderui commented 4 months ago

描述这个 bug 在对验证集进行验证时所使用的显存缓冲区没有被释放,导致在下一轮训练时可能会出现显存超出并训练变慢的情况。

如何复现 python .\run_recbole.py --dataset gowalla-merged --model GRU4RecCPR

预期 在每一轮结束后执行torch.cuda.empty_cache()清空显存

屏幕截图 未清空显存缓存: image 清空显存缓存: image 添加代码: image

实验环境(请补全下列信息):