我可以在colab中清理GPU显存吗
我正在尝试使用 aitextgen 在数据集上微调 774M gpt 2。不幸的是,无论我做什么,训练都会失败,因为只有 80 MB 的 vram 可用。如何在不重新启动运行时的情况下清除 vram,并可能防止 vram 已满?
I'm trying to use aitextgen to finetune 774M gpt 2 on a dataset. unfortunately, no matter what i do, training fails because there are only 80 mb of vram available. how can i clear the vram without restarting the runtime and maybe prevent the vram from being full?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
另一种解决方案是使用这些代码片段。
1.
你的问题在Tensorflow官方github上有讨论。 https://github.com/tensorflow/tensorflow/issues/36465
更新:@alchemy 报告说,在开启方面这是无法恢复的。
您可以尝试下面的代码。
Another solution can be using these code snippets.
1.
Your problem is discussed in Tensorflow official github. https://github.com/tensorflow/tensorflow/issues/36465
Update: @alchemy reported this to be unrecoverable in terms of turning on.
You can try below code.
!nvidia-smi
。!kill process_id
它应该对你有帮助。
!nvidia-smi
inside a notebook block.!kill process_id
It should help you.
PyTorch 自动管理 CUDA 内存,因此您通常不需要手动关闭设备。如果您想释放 GPU 内存,可以尝试以下操作:
PyTorch manages CUDA memory automatically, so you generally don't need to manually close devices. If you want to free up GPU memory, you can try the following: