From d45f7ea24097b89948d9668d6bf2cbe76ce503d8 Mon Sep 17 00:00:00 2001 From: Yeonsil Yoon Date: Fri, 23 Feb 2024 20:11:25 +0000 Subject: [PATCH 1/2] Adding a flag whether to save checkpoint or not after the training in run_lora_clm.py --- examples/language-modeling/run_lora_clm.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/language-modeling/run_lora_clm.py b/examples/language-modeling/run_lora_clm.py index 488dde879c..b2bf4fc670 100644 --- a/examples/language-modeling/run_lora_clm.py +++ b/examples/language-modeling/run_lora_clm.py @@ -265,6 +265,10 @@ class DataArguments: default=False, metadata={"help": "Whether to have a SQL style prompt"}, ) + save_last_ckpt: bool = field( + default=True, + metadata={"help": "Whether to save checkpoint at the end of the training."} + ) @dataclass @@ -720,7 +724,8 @@ def compute_metrics(eval_preds): if training_args.do_train: train_result = trainer.train(resume_from_checkpoint=training_args.resume_from_checkpoint) - trainer.save_model() + if data_args.save_last_ckpt: + trainer.save_model() metrics = train_result.metrics trainer.log_metrics("train", metrics) From 20461d9211287a7f4869170cb23c12ecb49ef126 Mon Sep 17 00:00:00 2001 From: Yeonsil Yoon Date: Mon, 26 Feb 2024 14:32:55 -0800 Subject: [PATCH 2/2] Update run_lora_clm.py --- examples/language-modeling/run_lora_clm.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/language-modeling/run_lora_clm.py b/examples/language-modeling/run_lora_clm.py index b2bf4fc670..df21ea9a48 100644 --- a/examples/language-modeling/run_lora_clm.py +++ b/examples/language-modeling/run_lora_clm.py @@ -266,8 +266,7 @@ class DataArguments: metadata={"help": "Whether to have a SQL style prompt"}, ) save_last_ckpt: bool = field( - default=True, - metadata={"help": "Whether to save checkpoint at the end of the training."} + default=True, metadata={"help": "Whether to save checkpoint at the end of the training."} )