问题:
Runtime Error: CUDA out of memory.
解决方案:
1.降低batch_size, 有时候管用,有时候不管用
2. 测试时,with torch.no_grad()
def early_test(self):
with torch.no_grad():
self.model.eval()
for path in tqdm(self.save_path,desc='Test Loop:'):
self.eval(path)
self.test()