cuda out of memory. tried to allocate 16.00 mib (gpu 0; 14.75 gib total capacity; 13.87 gib already allocated; 2.81 mib free; 13.97 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
这个问题可以通过调整bach_size来修复,需提前清楚运行所占内存。
import torch
torch.cuda.empty_cache()