From 57272d5ddf222bd1a20b7b16e693e69c74e56ea6 Mon Sep 17 00:00:00 2001 From: VictorSanh Date: Thu, 22 Aug 2019 00:25:49 -0400 Subject: [PATCH] fix for glue --- examples/run_glue.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/run_glue.py b/examples/run_glue.py index 1729f4f7e3..53b46fc102 100644 --- a/examples/run_glue.py +++ b/examples/run_glue.py @@ -251,7 +251,7 @@ def evaluate(args, model, tokenizer, prefix=""): def load_and_cache_examples(args, task, tokenizer, evaluate=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 processor = processors[task]() @@ -286,7 +286,7 @@ def load_and_cache_examples(args, task, tokenizer, evaluate=False): 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