Skip to content

Commit 742f24a

Browse files
Make quickstart finetuning notebook ready for T4 (meta-llama#562)
2 parents 0000619 + e74ba76 commit 742f24a

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

recipes/finetuning/quickstart_peft_finetuning.ipynb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"metadata": {},
77
"source": [
88
"Copyright (c) Meta Platforms, Inc. and affiliates.\n",
9-
"This software may be used and distributed according to the terms of the Llama 2 Community License Agreement."
9+
"This software may be used and distributed according to the terms of the Llama 2 Community License Agreement.\n",
10+
"\n",
11+
"<a href=\"https://colab.research.google.com/github/meta-llama/llama-recipes/blob/main/recipes/finetuning/quickstart_peft_finetuning.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
1012
]
1113
},
1214
{
@@ -16,7 +18,11 @@
1618
"source": [
1719
"## PEFT Finetuning Quick Start Notebook\n",
1820
"\n",
19-
"This notebook shows how to train a Meta Llama 3 model on a single GPU (e.g. A10 with 24GB) using int8 quantization and LoRA."
21+
"This notebook shows how to train a Meta Llama 3 model on a single GPU (e.g. A10 with 24GB) using int8 quantization and LoRA finetuning.\n",
22+
"\n",
23+
"**_Note:_** To run this notebook on a machine with less than 24GB VRAM (e.g. T4 with 16GB) the context length of the training dataset needs to be adapted.\n",
24+
"We do this based on the available VRAM during execution.\n",
25+
"If you run into OOM issues try to further lower the value of train_config.context_length."
2026
]
2127
},
2228
{
@@ -34,6 +40,7 @@
3440
"metadata": {},
3541
"outputs": [],
3642
"source": [
43+
"# uncomment if running from Colab T4\n",
3744
"# ! pip install llama-recipes ipywidgets\n",
3845
"\n",
3946
"# import huggingface_hub\n",
@@ -91,7 +98,7 @@
9198
"train_config.lr = 3e-4\n",
9299
"train_config.use_fast_kernels = True\n",
93100
"train_config.use_fp16 = True\n",
94-
"train_config.context_length = 2048\n",
101+
"train_config.context_length = 1024 if torch.cuda.get_device_properties(0).total_memory < 16e9 else 2048 # T4 16GB or A10 24GB\n",
95102
"train_config.batching_strategy = \"packing\"\n",
96103
"train_config.output_dir = \"meta-llama-samsum\"\n",
97104
"\n",
@@ -460,7 +467,7 @@
460467
"name": "python",
461468
"nbconvert_exporter": "python",
462469
"pygments_lexer": "ipython3",
463-
"version": "3.11.9"
470+
"version": "3.10.14"
464471
},
465472
"vscode": {
466473
"interpreter": {

0 commit comments

Comments
 (0)