Fix bug in examples: double wrap into DataParallel during eval
This commit is contained in:
committed by
Julien Chaumond
parent
7f23af1684
commit
b1ff0b2ae7
@@ -256,7 +256,7 @@ def evaluate(args, model, tokenizer, prefix="", test=False):
|
||||
eval_dataloader = DataLoader(eval_dataset, sampler=eval_sampler, batch_size=args.eval_batch_size)
|
||||
|
||||
# multi-gpu evaluate
|
||||
if args.n_gpu > 1:
|
||||
if args.n_gpu > 1 and not isinstance(model, torch.nn.DataParallel):
|
||||
model = torch.nn.DataParallel(model)
|
||||
|
||||
# Eval!
|
||||
|
||||
Reference in New Issue
Block a user