|
6 | 6 | "metadata": {},
|
7 | 7 | "source": [
|
8 | 8 | "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>" |
10 | 12 | ]
|
11 | 13 | },
|
12 | 14 | {
|
|
16 | 18 | "source": [
|
17 | 19 | "## PEFT Finetuning Quick Start Notebook\n",
|
18 | 20 | "\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." |
20 | 26 | ]
|
21 | 27 | },
|
22 | 28 | {
|
|
34 | 40 | "metadata": {},
|
35 | 41 | "outputs": [],
|
36 | 42 | "source": [
|
| 43 | + "# uncomment if running from Colab T4\n", |
37 | 44 | "# ! pip install llama-recipes ipywidgets\n",
|
38 | 45 | "\n",
|
39 | 46 | "# import huggingface_hub\n",
|
|
91 | 98 | "train_config.lr = 3e-4\n",
|
92 | 99 | "train_config.use_fast_kernels = True\n",
|
93 | 100 | "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", |
95 | 102 | "train_config.batching_strategy = \"packing\"\n",
|
96 | 103 | "train_config.output_dir = \"meta-llama-samsum\"\n",
|
97 | 104 | "\n",
|
|
460 | 467 | "name": "python",
|
461 | 468 | "nbconvert_exporter": "python",
|
462 | 469 | "pygments_lexer": "ipython3",
|
463 |
| - "version": "3.11.9" |
| 470 | + "version": "3.10.14" |
464 | 471 | },
|
465 | 472 | "vscode": {
|
466 | 473 | "interpreter": {
|
|
0 commit comments