Fix multi-gpu evaluation in run_glue.py

This commit is contained in:
Peter Izsak authored and Lysandre Debut committed 2020-02-06 16:38:55 -05:00
1 parent 7748cbbe7d
commit 6fc3d34abd
1 file changed
+1 -1
+1 -1
View File
@@ -310,7 +310,7 @@ def evaluate(args, model, tokenizer, prefix=""):
eval_dataloader = DataLoader(eval_dataset, sampler=eval_sampler, batch_size=args.eval_batch_size)
# multi-gpu eval
if args.n_gpu > 1:
if args.n_gpu > 1 and not isinstance(model, torch.nn.DataParallel):
model = torch.nn.DataParallel(model)
# Eval!