【发布时间】:2022-07-15 22:33:33
【问题描述】:
在训练模型时,我遇到了以下问题:
RuntimeError: CUDA out of memory. Tried to allocate 304.00 MiB (GPU 0; 8.00 GiB total capacity; 142.76 MiB already allocated; 6.32 GiB free; 158.00 MiB 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
正如我们所见,尝试分配 304 MiB 内存时发生错误,而 6.32 GiB 是空闲的!问题是什么?如我所见,建议的选项是设置 max_split_size_mb 以避免碎片。它会有所帮助吗?如何正确地做到这一点?
这是我的 PyTorch 版本:
火炬==1.10.2+cu113
torchvision==0.11.3+cu113
火炬===0.10.2+cu113
【问题讨论】:
标签: python machine-learning pytorch computer-vision