Skip to content

Commit fc12441

Browse files
committed
Enable LoRA for all linear layers in tinyllama (#1122)
1 parent af41ee9 commit fc12441

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

config_hub/finetune/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
## Config files
22

3-
The table below lists the performances you can expect from the provided config files. Note that you can achieve lower memory consumption by lowering the micro batch size as needed. See the [Dealing with out-of-memory (OOM) errors](../../tutorials/oom.md) on lowering the memory requirements.
3+
The table below lists the performances you can expect from the provided config files. Note that you can achieve lower memory consumption by lowering the micro batch size as needed. In addition, you can lower the rank (`lora_r`) in the LoRA configuration files and disable LoRA for certain layers (for example, setting `lora_projection` and other LoRA layer-specific parameters to `false`).
4+
For more information, see the [Dealing with out-of-memory (OOM) errors](../../tutorials/oom.md) on lowering the memory requirements.
45

56
| | Size | Dataset | Epochs | Val loss | Peak memory | Max seq length | Micro batch size | Precision | Training runtime |
67
| --------------------- | ---- | --------- | ------ | -------- | ----------- | -------------- | ---------------- | --------- | ---------------- |
7-
| tiny-llama/lora.yaml | 1.1B | Alpaca 2k | 4 | 1.053 | 10.54 GB | 512 | 8 | bfloat16 | 9.24 min (A10G) |
8-
| tiny-llama/qlora.yaml | 1.1B | Alpaca 2k | 4 | 1.074 | 13.32 GB | 512 | 8 | bfloat16 | 9.89 min (A10G) |
8+
| tiny-llama/lora.yaml | 1.1B | Alpaca 2k | 3 | 1.038 | 13.50 GB | 512 | 8 | bfloat16 | 8.06 min (A10G) |
9+
| tiny-llama/qlora.yaml | 1.1B | Alpaca 2k | 3 | 1.056 | 16.24 GB | 512 | 8 | bfloat16 | 8.74 min (A10G) |
910
| tiny-llama/full.yaml | 1.1B | Alpaca 2k | 1 | 1.105 | 14.10 GB | 512 | 4 | bfloat16 | 2.59 min (A10G) |
1011
| llama-2-7b/qlora.yaml | 7B | Alpaca 2k | 4 | 0.814 | 13.68 GB | 512 | 2 | bfloat16 | 45.68 min (A10G) |

config_hub/finetune/tiny-llama/lora.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ lora_dropout: 0.05
2727
lora_query: true
2828

2929
# Whether to apply LoRA to the key weights in attention. (type: bool, default: False)
30-
lora_key: false
30+
lora_key: true
3131

3232
# Whether to apply LoRA to the value weights in attention. (type: bool, default: True)
3333
lora_value: true
3434

3535
# Whether to apply LoRA to the output projection in the attention block. (type: bool, default: False)
36-
lora_projection: false
36+
lora_projection: true
3737

3838
# Whether to apply LoRA to the weights of the MLP in the attention block. (type: bool, default: False)
39-
lora_mlp: false
39+
lora_mlp: true
4040

4141
# Whether to apply LoRA to output head in GPT. (type: bool, default: False)
42-
lora_head: false
42+
lora_head: true
4343

4444
# Data-related arguments. If not provided, the default is ``litgpt.data.Alpaca``.
4545
data:
@@ -71,7 +71,7 @@ train:
7171
lr_warmup_steps: 10
7272

7373
# Number of epochs to train on (type: Optional[int], default: 5)
74-
epochs: 4
74+
epochs: 3
7575

7676
# Total number of tokens to train on (type: Optional[int], default: null)
7777
max_tokens:

config_hub/finetune/tiny-llama/qlora.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ lora_dropout: 0.05
2727
lora_query: true
2828

2929
# Whether to apply LoRA to the key weights in attention. (type: bool, default: False)
30-
lora_key: false
30+
lora_key: true
3131

3232
# Whether to apply LoRA to the value weights in attention. (type: bool, default: True)
3333
lora_value: true
3434

3535
# Whether to apply LoRA to the output projection in the attention block. (type: bool, default: False)
36-
lora_projection: false
36+
lora_projection: true
3737

3838
# Whether to apply LoRA to the weights of the MLP in the attention block. (type: bool, default: False)
39-
lora_mlp: false
39+
lora_mlp: true
4040

4141
# Whether to apply LoRA to output head in GPT. (type: bool, default: False)
42-
lora_head: false
42+
lora_head: true
4343

4444
# Data-related arguments. If not provided, the default is ``litgpt.data.Alpaca``.
4545
data:
@@ -71,7 +71,7 @@ train:
7171
lr_warmup_steps: 10
7272

7373
# Number of epochs to train on (type: Optional[int], default: 5)
74-
epochs: 4
74+
epochs: 3
7575

7676
# Total number of tokens to train on (type: Optional[int], default: null)
7777
max_tokens:

0 commit comments

Comments
 (0)