From 1f8b704981f046e240709db5256d5e5a268f3610 Mon Sep 17 00:00:00 2001 From: Daniel Fried Date: Wed, 7 Jun 2023 12:20:04 -0400 Subject: [PATCH 1/3] Update README.md Add `clean_up_tokenization_spaces=False` argument for `tokenizer.decode` to README. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5e53236..b800f42 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,8 @@ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device) inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to(device) outputs = model.generate(inputs) -print(tokenizer.decode(outputs[0])) +# clean_up_tokenization_spaces=False prevents a tokenizer edge case which can result in spaces being removed around punctuation +print(tokenizer.decode(outputs[0], clean_up_tokenization_spaces=False)) ``` or ```python From 0d275cddf7a63fc7c32851af5e1ebdb918bb61c0 Mon Sep 17 00:00:00 2001 From: ArmelRandy <76953833+ArmelRandy@users.noreply.github.com> Date: Wed, 28 Jun 2023 16:55:59 +0200 Subject: [PATCH 2/3] Removing argument prompt_type, which is not supported by the parser. --- chat/generate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chat/generate.py b/chat/generate.py index 64a3905..c67d7d8 100644 --- a/chat/generate.py +++ b/chat/generate.py @@ -127,7 +127,7 @@ def main(): print() raw_model_name = args.model_id.split("/")[-1] - model_name = f"{raw_model_name}-{args.prompt_type}" + model_name = f"{raw_model_name}" if args.revision is not None: model_name += f"-{args.revision}" From d72c7fe3dda81d47ad9b851f9567393fb6b551b9 Mon Sep 17 00:00:00 2001 From: ArmelRandy <76953833+ArmelRandy@users.noreply.github.com> Date: Thu, 29 Jun 2023 10:07:07 +0200 Subject: [PATCH 3/3] Add load_best_model_at_end=True --- finetune/finetune.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/finetune/finetune.py b/finetune/finetune.py index 96ab961..525b37f 100644 --- a/finetune/finetune.py +++ b/finetune/finetune.py @@ -267,6 +267,8 @@ def run_training(args, train_data, val_data): output_dir=args.output_dir, dataloader_drop_last=True, evaluation_strategy="steps", + save_strategy="steps", + load_best_model_at_end=True, max_steps=args.max_steps, eval_steps=args.eval_freq, save_steps=args.save_freq, @@ -309,4 +311,4 @@ def main(args): logging.set_verbosity_error() - main(args) \ No newline at end of file + main(args)