mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2026-04-10 12:33:42 +00:00
Add standalone instruction finetuning script (#233)
This commit is contained in:
committed by
GitHub
parent
bebd3f453f
commit
d440eb17bc
@@ -8,4 +8,50 @@
|
||||
|
||||
### Optional Code
|
||||
|
||||
- [load-finetuned-model.ipynb](load-finetuned-model.ipynb) is a standalone Jupyter notebook to load the instruction finetuned model we created in this chapter
|
||||
- [load-finetuned-model.ipynb](load-finetuned-model.ipynb) is a standalone Jupyter notebook to load the instruction finetuned model we created in this chapter
|
||||
|
||||
- [gpt-instruction-finetuning.py](gpt-instruction-finetuning.py) is a standalone Python script to instruction finetune the model as described in the main chapter
|
||||
|
||||
Usage:
|
||||
|
||||
```bash
|
||||
python gpt-instruction-finetuning.py
|
||||
```
|
||||
|
||||
```
|
||||
matplotlib version: 3.9.0
|
||||
tiktoken version: 0.7.0
|
||||
torch version: 2.3.1
|
||||
tqdm version: 4.66.4
|
||||
tensorflow version: 2.16.1
|
||||
--------------------------------------------------
|
||||
Training set length: 935
|
||||
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
|
||||
File already exists and is up-to-date: gpt2/355M/model.ckpt.data-00000-of-00001
|
||||
File already exists and is up-to-date: gpt2/355M/model.ckpt.index
|
||||
File already exists and is up-to-date: gpt2/355M/model.ckpt.meta
|
||||
File already exists and is up-to-date: gpt2/355M/vocab.bpe
|
||||
Loaded model: gpt2-medium (355M)
|
||||
--------------------------------------------------
|
||||
Initial losses
|
||||
Training loss: 3.839039182662964
|
||||
Validation loss: 3.7619192123413088
|
||||
Ep 1 (Step 000000): Train loss 2.611, Val loss 2.668
|
||||
Ep 1 (Step 000005): Train loss 1.161, Val loss 1.131
|
||||
Ep 1 (Step 000010): Train loss 0.939, Val loss 0.973
|
||||
...
|
||||
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]
|
||||
Responses saved as instruction-data-with-response-standalone.json
|
||||
Model saved as gpt2-medium355M-sft-standalone.pth
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user