站点图标 AI技术聚合

RuntimeError: CUDA out of memory See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

报错:
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

当reserved memory is >> allocated memory,进行如下设置,可解决此bug:
代码如下:

import os
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "max_split_size_mb:128"

文章出处登录后可见!

已经登录?立即刷新
退出移动版