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"

猜你喜欢

转载自blog.csdn.net/zfjBIT/article/details/129777091