Commit aad3a54e authored by thomwolf's avatar thomwolf
Browse files

fix paths

parent 40dbda68
...@@ -380,24 +380,22 @@ def main(): ...@@ -380,24 +380,22 @@ def main():
### Evaluation ### Evaluation
if args.do_eval: if args.do_eval:
eval_examples = processor.get_dev_examples(args.data_dir) eval_examples = processor.get_dev_examples(args.data_dir)
cached_train_features_file = os.path.join(args.data_dir, 'dev_{0}_{1}_{2}'.format( cached_eval_features_file = os.path.join(args.data_dir, 'dev_{0}_{1}_{2}'.format(
list(filter(None, args.bert_model.split('/'))).pop(), list(filter(None, args.bert_model.split('/'))).pop(),
str(args.max_seq_length), str(args.max_seq_length),
str(task_name))) str(task_name)))
try: try:
with open(cached_train_features_file, "rb") as reader: with open(cached_eval_features_file, "rb") as reader:
train_features = pickle.load(reader) train_features = pickle.load(reader)
except: except:
train_features = convert_examples_to_features( eval_features = convert_examples_to_features(
train_examples, label_list, args.max_seq_length, tokenizer, output_mode) eval_examples, label_list, args.max_seq_length, tokenizer, output_mode)
if args.local_rank == -1 or torch.distributed.get_rank() == 0: if args.local_rank == -1 or torch.distributed.get_rank() == 0:
logger.info(" Saving train features into cached file %s", cached_train_features_file) logger.info(" Saving eval features into cached file %s", cached_eval_features_file)
with open(cached_train_features_file, "wb") as writer: with open(cached_eval_features_file, "wb") as writer:
pickle.dump(train_features, writer) pickle.dump(eval_features, writer)
eval_features = convert_examples_to_features(
eval_examples, label_list, args.max_seq_length, tokenizer, output_mode)
logger.info("***** Running evaluation *****") logger.info("***** Running evaluation *****")
logger.info(" Num examples = %d", len(eval_examples)) logger.info(" Num examples = %d", len(eval_examples))
logger.info(" Batch size = %d", args.eval_batch_size) logger.info(" Batch size = %d", args.eval_batch_size)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment