Skip to content

Commit 350bb6b

Browse files
author
Rabeeh KARIMI
committed
updated tokenizer loading for addressing reproducibility issues
1 parent 3d47a7f commit 350bb6b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/run_glue.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -448,13 +448,14 @@ def main():
448448

449449
# Load a trained model and vocabulary that you have fine-tuned
450450
model = model_class.from_pretrained(args.output_dir)
451-
tokenizer = tokenizer_class.from_pretrained(args.output_dir)
451+
tokenizer = tokenizer_class.from_pretrained(args.output_dir, do_lower_case=args.do_lower_case)
452452
model.to(args.device)
453453

454454

455455
# Evaluation
456456
results = {}
457457
if args.do_eval and args.local_rank in [-1, 0]:
458+
tokenizer = tokenizer_class.from_pretrained(args.output_dir, do_lower_case=args.do_lower_case)
458459
checkpoints = [args.output_dir]
459460
if args.eval_all_checkpoints:
460461
checkpoints = list(os.path.dirname(c) for c in sorted(glob.glob(args.output_dir + '/**/' + WEIGHTS_NAME, recursive=True)))
@@ -463,7 +464,6 @@ def main():
463464
for checkpoint in checkpoints:
464465
global_step = checkpoint.split('-')[-1] if len(checkpoints) > 1 else ""
465466
model = model_class.from_pretrained(checkpoint)
466-
tokenizer = tokenizer_class.from_pretrained(checkpoint)
467467
model.to(args.device)
468468
result = evaluate(args, model, tokenizer, prefix=global_step)
469469
result = dict((k + '_{}'.format(global_step), v) for k, v in result.items())

0 commit comments

Comments
 (0)