From b006a7a12f553b374bdf781a8206e62e96d6d144 Mon Sep 17 00:00:00 2001 From: VictorSanh Date: Thu, 22 Aug 2019 00:25:42 -0400 Subject: [PATCH] fix for squad --- examples/run_squad.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/run_squad.py b/examples/run_squad.py index c0586b03bd..25e2c4093f 100644 --- a/examples/run_squad.py +++ b/examples/run_squad.py @@ -272,7 +272,7 @@ def evaluate(args, model, tokenizer, prefix=""): def load_and_cache_examples(args, tokenizer, evaluate=False, output_examples=False): - if args.local_rank not in [-1, 0]: + if args.local_rank not in [-1, 0] and not evaluate: torch.distributed.barrier() # Make sure only the first process in distributed training process the dataset, and the others will use the cache # Load data features from cache or dataset file @@ -299,7 +299,7 @@ def load_and_cache_examples(args, tokenizer, evaluate=False, output_examples=Fal logger.info("Saving features into cached file %s", cached_features_file) torch.save(features, cached_features_file) - if args.local_rank == 0: + if args.local_rank == 0 and not evaluate: torch.distributed.barrier() # Make sure only the first process in distributed training process the dataset, and the others will use the cache # Convert to Tensors and build dataset