Fix bug in examples: double wrap into DataParallel during eval

This commit is contained in:
Andrey Kulagin
2020-04-17 17:33:24 +03:00
committed by Julien Chaumond
parent 7f23af1684
commit b1ff0b2ae7
6 changed files with 6 additions and 6 deletions

View File

@@ -278,7 +278,7 @@ def evaluate(args, model, tokenizer, criterion, prefix=""):
)
# 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!