Fix the OOM problem during evaluation
@@ -301,11 +301,13 @@ class Trainer(object):
collate_fn=collate_fn)
self.model.eval()
+
avg_loss = num_samples = 0
sum_metrics = defaultdict(int)
avg_metrics = defaultdict(int)
with logger.processing('Evaluation on validation dataset'):
+ with paddle.no_grad():
for batch_idx, batch in enumerate(loader):
result = self.validation_step(batch, batch_idx)
