Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: CUDA out of memory. #66

Open
Dejavusd opened this issue Nov 29, 2021 · 5 comments
Open

RuntimeError: CUDA out of memory. #66

Dejavusd opened this issue Nov 29, 2021 · 5 comments

Comments

@Dejavusd
Copy link

我使用的是cityscapes来训练的,配置好了您的预训练权重,运行main.py时不管batchsize设置多少都会报错
RuntimeError: CUDA out of memory. Tried to allocate 86.00 MiB (GPU 0; 4.00 GiB total capacity; 2.09 GiB already allocated; 61.09 MiB free; 2.15 GiB reserved in total by PyTorch)

@B-1368
Copy link

B-1368 commented Nov 29, 2021

4G显存是不是有点太小了?可以换一个大点显存的显卡或者试着在main.py里面把训练时输入的图像尺寸调小

@Dejavusd
Copy link
Author

4G显存是不是有点太小了?可以换一个大点显存的显卡或者试着在main.py里面把训练时输入的图像尺寸调小

我将batchsize换成了2,将crop_size换成了224,可以跑通10个但是还是会报错
RuntimeError: CUDA out of memory. Tried to allocate 512.00 MiB (GPU 0; 4.00 GiB total capacity; 1.50 GiB already allocated; 195.49 MiB free; 2.30 GiB reserved in total by PyTorch)
微信截图_20211130204147

@B-1368
Copy link

B-1368 commented Nov 30, 2021

感觉还是换个大点显存的显卡试试吧,双卡12g显存的应该够

@VainF
Copy link
Owner

VainF commented Dec 1, 2021

@Dejavusd 您好,cityscapes数据集上的模型使用裁剪图片(513x513)做训练,用整张图片(1024x2048)进行测试,可能会导致验证阶段内存不足。

@Chihanxx
Copy link

@Dejavusd 您好,cityscapes数据集上的模型使用裁剪图片(513x513)做训练,用整张图片(1024x2048)进行测试,可能会导致验证阶段内存不足。

您好,我想使用双卡训练该网络,请问如何运行代码

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants