From 4c2b503785e5d53ba3356427fe2d0f35f61cb649 Mon Sep 17 00:00:00 2001 From: rasbt Date: Fri, 21 Jun 2024 06:31:31 -0500 Subject: [PATCH] update --- ch07/01_main-chapter-code/README.md | 3 ++- ch07/01_main-chapter-code/gpt_instruction_finetuning.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ch07/01_main-chapter-code/README.md b/ch07/01_main-chapter-code/README.md index 2ab6745f..a71c7ca8 100644 --- a/ch07/01_main-chapter-code/README.md +++ b/ch07/01_main-chapter-code/README.md @@ -30,6 +30,7 @@ Validation set length: 55 Test set length: 110 -------------------------------------------------- Device: cpu +-------------------------------------------------- File already exists and is up-to-date: gpt2/355M/checkpoint File already exists and is up-to-date: gpt2/355M/encoder.json File already exists and is up-to-date: gpt2/355M/hparams.json @@ -50,7 +51,7 @@ Training completed in 15.66 minutes. Plot saved as loss-plot-standalone.pdf -------------------------------------------------- Generating responses -100%|██████████████████████████████████████████████████████████████████████████| 110/110 [06:57<00:00, 3.80s/it] +100%|█████████████████████████████████████████████████████████| 110/110 [06:57<00:00, 3.80s/it] Responses saved as instruction-data-with-response-standalone.json Model saved as gpt2-medium355M-sft-standalone.pth ``` diff --git a/ch07/01_main-chapter-code/gpt_instruction_finetuning.py b/ch07/01_main-chapter-code/gpt_instruction_finetuning.py index d6644dce..5d6f3d0c 100644 --- a/ch07/01_main-chapter-code/gpt_instruction_finetuning.py +++ b/ch07/01_main-chapter-code/gpt_instruction_finetuning.py @@ -185,6 +185,8 @@ def main(): tokenizer = tiktoken.get_encoding("gpt2") device = torch.device("cuda" if torch.cuda.is_available() else "cpu") print("Device:", device) + print(50*"-") + customized_collate_fn = partial(custom_collate_fn, device=device, allowed_max_length=1024) num_workers = 0