From 6ba8a939b13d5b4b3a087e3da503d653e8c6dfe4 Mon Sep 17 00:00:00 2001 From: Erdi Tac Date: Tue, 28 Sep 2021 15:10:33 +0800 Subject: [PATCH 1/2] prediction_loss_only as an arg In the new version of the Trainer prediction_loss_only is not a part of the **kwargs, it should be passed as a separate arg. --- run_qg.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/run_qg.py b/run_qg.py index 20b8abe..54966da 100644 --- a/run_qg.py +++ b/run_qg.py @@ -177,6 +177,9 @@ def main(args_file=None): mode="training", using_tpu=training_args.tpu_num_cores is not None ) + + # Prediction Loss + training_args.prediction_loss_only=True, # Initialize our Trainer trainer = Trainer( @@ -185,7 +188,6 @@ def main(args_file=None): train_dataset=train_dataset, eval_dataset=valid_dataset, data_collator=data_collator, - prediction_loss_only=True, label_smoothing=model_args.label_smoothing ) @@ -233,4 +235,4 @@ def run_qg(args_dict): main(args_file="args.json") if __name__ == "__main__": - main() \ No newline at end of file + main() From 191bf4ffdd3806ef0f85ad106a6d5925e58d8362 Mon Sep 17 00:00:00 2001 From: Erdi Tac Date: Wed, 29 Sep 2021 08:38:56 +0800 Subject: [PATCH 2/2] trainer.is_world_master is depreciated Replace trainer.is_world_master() with trainer.is_world_process_zero() --- run_qg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run_qg.py b/run_qg.py index 54966da..51ed7ac 100644 --- a/run_qg.py +++ b/run_qg.py @@ -202,7 +202,7 @@ def main(args_file=None): trainer.save_model() # For convenience, we also re-save the tokenizer to the same directory, # so that you can share your model easily on huggingface.co/models =) - if trainer.is_world_master(): + if trainer.is_world_process_zero(): tokenizer.save_pretrained(training_args.output_dir) # Evaluation