From 801aaa55087d80a5d736b619bce0344af25e9883 Mon Sep 17 00:00:00 2001 From: Julien Chaumond Date: Fri, 17 Jan 2020 23:13:51 +0000 Subject: [PATCH] make style --- examples/run_lm_finetuning.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/run_lm_finetuning.py b/examples/run_lm_finetuning.py index 5e02d80ae..8e345ae8a 100644 --- a/examples/run_lm_finetuning.py +++ b/examples/run_lm_finetuning.py @@ -228,8 +228,10 @@ def train(args, train_dataset, model: PreTrainedModel, tokenizer: PreTrainedToke ) # Check if saved optimizer or scheduler states exist - if args.model_name_or_path and os.path.isfile(os.path.join(args.model_name_or_path, "optimizer.pt")) and os.path.isfile( - os.path.join(args.model_name_or_path, "scheduler.pt") + if ( + args.model_name_or_path + and os.path.isfile(os.path.join(args.model_name_or_path, "optimizer.pt")) + and os.path.isfile(os.path.join(args.model_name_or_path, "scheduler.pt")) ): # Load in optimizer and scheduler states optimizer.load_state_dict(torch.load(os.path.join(args.model_name_or_path, "optimizer.pt"))) @@ -587,9 +589,7 @@ def main(): if args.should_continue: sorted_checkpoints = _sorted_checkpoints(args) if len(sorted_checkpoints) == 0: - raise ValueError( - "Used --should_continue but no checkpoint was found in --output_dir." - ) + raise ValueError("Used --should_continue but no checkpoint was found in --output_dir.") else: args.model_name_or_path = sorted_checkpoints[-1]