mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2025-08-29 02:50:15 +00:00
updated .gitignore for ch07/01 artefacts (#242)
* fixed markdown * removed redundant imports * updated .gitignore for ch07/01 artefacts
This commit is contained in:
parent
519bfd6dc5
commit
82c06420ac
13
.gitignore
vendored
13
.gitignore
vendored
@ -18,6 +18,10 @@ ch06/01_main-chapter-code/accuracy-plot.pdf
|
|||||||
|
|
||||||
ch07/01_main-chapter-code/loss-plot.pdf
|
ch07/01_main-chapter-code/loss-plot.pdf
|
||||||
ch07/01_main-chapter-code/loss-plot-standalone.pdf
|
ch07/01_main-chapter-code/loss-plot-standalone.pdf
|
||||||
|
ch07/01_main-chapter-code/loss-plot-baseline.pdf
|
||||||
|
ch07/01_main-chapter-code/loss-plot-mask-instructions.pdf
|
||||||
|
ch07/01_main-chapter-code/loss-plot-phi3-prompt.pdf
|
||||||
|
ch07/01_main-chapter-code/loss-plot-alpaca52k.pdf
|
||||||
|
|
||||||
# Checkpoint files
|
# Checkpoint files
|
||||||
appendix-A/01_main-chapter-code/model.pth
|
appendix-A/01_main-chapter-code/model.pth
|
||||||
@ -34,6 +38,11 @@ ch06/01_main-chapter-code/gpt2
|
|||||||
ch06/02_bonus_additional-experiments/gpt2
|
ch06/02_bonus_additional-experiments/gpt2
|
||||||
ch06/03_bonus_imdb-classification/gpt2
|
ch06/03_bonus_imdb-classification/gpt2
|
||||||
|
|
||||||
|
ch07/01_main-chapter-code/gpt2-medium355M-sft-baseline.pth
|
||||||
|
ch07/01_main-chapter-code/gpt2-medium355M-sft-mask-instructions.pth
|
||||||
|
ch07/01_main-chapter-code/gpt2-medium355M-sft-phi3-prompt.pth
|
||||||
|
ch07/01_main-chapter-code/gpt2-medium355M-sft-alpaca52k.pth
|
||||||
|
ch07/01_main-chapter-code/gpt2-medium355M-sft-lora.pth
|
||||||
ch07/01_main-chapter-code/gpt2-medium355M-sft.pth
|
ch07/01_main-chapter-code/gpt2-medium355M-sft.pth
|
||||||
ch07/01_main-chapter-code/gpt2-medium355M-sft-standalone.pth
|
ch07/01_main-chapter-code/gpt2-medium355M-sft-standalone.pth
|
||||||
ch07/01_main-chapter-code/Smalltestmodel-sft-standalone.pth
|
ch07/01_main-chapter-code/Smalltestmodel-sft-standalone.pth
|
||||||
@ -71,6 +80,10 @@ ch06/03_bonus_imdb-classification/validation.csv
|
|||||||
ch07/01_main-chapter-code/instruction-data-with-response-standalone.json
|
ch07/01_main-chapter-code/instruction-data-with-response-standalone.json
|
||||||
ch07/01_main-chapter-code/instruction-data-with-response-baseline.json
|
ch07/01_main-chapter-code/instruction-data-with-response-baseline.json
|
||||||
ch07/01_main-chapter-code/instruction-data-with-response-mask-instructions.json
|
ch07/01_main-chapter-code/instruction-data-with-response-mask-instructions.json
|
||||||
|
ch07/01_main-chapter-code/loss-plot-lora.pdf
|
||||||
|
ch07/01_main-chapter-code/instruction-data-with-response-alpaca52k.json
|
||||||
|
ch07/01_main-chapter-code/instruction-data-with-response-lora.json
|
||||||
|
ch07/01_main-chapter-code/instruction-data-with-response-phi3-prompt.json
|
||||||
ch07/02_dataset-utilities/instruction-examples-modified.json
|
ch07/02_dataset-utilities/instruction-examples-modified.json
|
||||||
|
|
||||||
# Temporary OS-related files
|
# Temporary OS-related files
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"Suppose we have the following data entry:\n",
|
"Suppose we have the following data entry:\n",
|
||||||
"\n",
|
"\n",
|
||||||
"```\n",
|
"```json\n",
|
||||||
"{\n",
|
"{\n",
|
||||||
" \"instruction\": \"Identify the correct spelling of the following word.\",\n",
|
" \"instruction\": \"Identify the correct spelling of the following word.\",\n",
|
||||||
" \"input\": \"Ocassion\",\n",
|
" \"input\": \"Ocassion\",\n",
|
||||||
@ -195,7 +195,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"```python\n",
|
"```python\n",
|
||||||
" for i, entry in tqdm(enumerate(test_data), total=len(test_data)):\n",
|
"for i, entry in tqdm(enumerate(test_data), total=len(test_data)):\n",
|
||||||
"\n",
|
"\n",
|
||||||
" input_text = format_input(entry)\n",
|
" input_text = format_input(entry)\n",
|
||||||
" tokenizer=tokenizer\n",
|
" tokenizer=tokenizer\n",
|
||||||
@ -229,7 +229,7 @@
|
|||||||
"id": "dd8158e9-cc70-4e0f-88b0-73c3e1d8c030",
|
"id": "dd8158e9-cc70-4e0f-88b0-73c3e1d8c030",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"```python\n",
|
"```bash\n",
|
||||||
"python exercise_experiments.py --exercise_solution phi3_prompt\n",
|
"python exercise_experiments.py --exercise_solution phi3_prompt\n",
|
||||||
"```\n",
|
"```\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -273,7 +273,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"Let's take a look at some of the responses to make sure they have been formatted correctly:\n",
|
"Let's take a look at some of the responses to make sure they have been formatted correctly:\n",
|
||||||
"\n",
|
"\n",
|
||||||
"```\n",
|
"```json\n",
|
||||||
" {\n",
|
" {\n",
|
||||||
" \"instruction\": \"Rewrite the sentence using a simile.\",\n",
|
" \"instruction\": \"Rewrite the sentence using a simile.\",\n",
|
||||||
" \"input\": \"The car is very fast.\",\n",
|
" \"input\": \"The car is very fast.\",\n",
|
||||||
@ -296,7 +296,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"We can evaluate the performance using the Ollama Llama 3 method, which is for your convenience, also implemented in the `python exercise_experiments.py` script, which we can run as follows:\n",
|
"We can evaluate the performance using the Ollama Llama 3 method, which is for your convenience, also implemented in the `python exercise_experiments.py` script, which we can run as follows:\n",
|
||||||
"\n",
|
"\n",
|
||||||
"```python\n",
|
"```bash\n",
|
||||||
"python ollama_evaluate.py --file_path instruction-data-with-response-phi3-prompt.json\n",
|
"python ollama_evaluate.py --file_path instruction-data-with-response-phi3-prompt.json\n",
|
||||||
"```\n",
|
"```\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -309,7 +309,7 @@
|
|||||||
"Average score: 48.87\n",
|
"Average score: 48.87\n",
|
||||||
"```\n",
|
"```\n",
|
||||||
"\n",
|
"\n",
|
||||||
"The score is close to 50, which is in the same ballpark as the score we previously achieved with the Alpaca-style prompts.\n"
|
"The score is close to 50, which is in the same ballpark as the score we previously achieved with the Alpaca-style prompts."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -802,7 +802,7 @@
|
|||||||
"id": "be9ab66f-5819-4b01-9a03-c45aa3b7c5b8",
|
"id": "be9ab66f-5819-4b01-9a03-c45aa3b7c5b8",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"```\n",
|
"```json\n",
|
||||||
"[\n",
|
"[\n",
|
||||||
" {\n",
|
" {\n",
|
||||||
" \"instruction\": \"Edit the following sentence to increase readability: \\\"He made a huge effort and was so successful.\\\"\",\n",
|
" \"instruction\": \"Edit the following sentence to increase readability: \\\"He made a huge effort and was so successful.\\\"\",\n",
|
||||||
@ -832,7 +832,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"Finally, we can evaluate the finetuned LLM using the [ollama_evaluate.py](ollama_evaluate.py) utility function:\n",
|
"Finally, we can evaluate the finetuned LLM using the [ollama_evaluate.py](ollama_evaluate.py) utility function:\n",
|
||||||
"\n",
|
"\n",
|
||||||
"```\n",
|
"```bash\n",
|
||||||
"python ollama_evaluate.py --file_path instruction-data-with-response-alpaca52k.json\n",
|
"python ollama_evaluate.py --file_path instruction-data-with-response-alpaca52k.json\n",
|
||||||
"```\n",
|
"```\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -867,7 +867,7 @@
|
|||||||
"To instruction finetune the model using LoRA, use the relevant classes and functions from appendix E:\n",
|
"To instruction finetune the model using LoRA, use the relevant classes and functions from appendix E:\n",
|
||||||
"\n",
|
"\n",
|
||||||
"```python\n",
|
"```python\n",
|
||||||
" from appendix_E import LoRALayer, LinearWithLoRA, replace_linear_with_lora\n",
|
"from appendix_E import LoRALayer, LinearWithLoRA, replace_linear_with_lora\n",
|
||||||
"```"
|
"```"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -961,7 +961,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"We can evaluate the performance using the Ollama Llama 3 method, which is for your convenience, also implemented in the `python exercise_experiments.py` script, which we can run as follows:\n",
|
"We can evaluate the performance using the Ollama Llama 3 method, which is for your convenience, also implemented in the `python exercise_experiments.py` script, which we can run as follows:\n",
|
||||||
"\n",
|
"\n",
|
||||||
"```python\n",
|
"```bash\n",
|
||||||
"python ollama_evaluate.py --file_path instruction-data-with-response-lora.json\n",
|
"python ollama_evaluate.py --file_path instruction-data-with-response-lora.json\n",
|
||||||
"```\n",
|
"```\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -994,7 +994,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.11.4"
|
"version": "3.10.11"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
@ -86,8 +86,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"from gpt_download import download_and_load_gpt2\n",
|
"from previous_chapters import GPTModel\n",
|
||||||
"from previous_chapters import GPTModel, load_weights_into_gpt\n",
|
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"BASE_CONFIG = {\n",
|
"BASE_CONFIG = {\n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user