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

显存被占满 #28

Closed
Zaragoto opened this issue Jan 22, 2024 · 1 comment
Closed

显存被占满 #28

Zaragoto opened this issue Jan 22, 2024 · 1 comment

Comments

@Zaragoto
Copy link

您好,我在试运行您的代码的时候,显示我的显存被占满。报错信息如下:

RuntimeError: CUDA out of memory. Tried to allocate 290.00 MiB (GPU 0; 31.75 GiB total capacity; 29.78 GiB already allocated; 113.50 MiB free; 30.27 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

我检索到占满内存的代码是 loss = model(image, caption, alpha=alpha, idx=idx)

想问一下该怎么解决内存占满的问题呢?谢谢!

@sdc17
Copy link
Owner

sdc17 commented Jan 22, 2024

您好,如果有多卡,可以尝试使用python -m torch.distributed.run进行多卡训练。如果使用单卡,可以将超参数batch size的数值调小。

Hi, if you have multiple GPUs, please launch scripts with python -m torch.distributed.run for distributed training. If you are using a single GPU, please try a smaller value for batch size.

@sdc17 sdc17 closed this as completed Jan 26, 2024
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

2 participants