Tim Dolan commited on
Commit
c75f916
1 Parent(s): 4d2e842

added tiny llama examples for lora and qlora (#1027)

Browse files

* added tiny llama examples for lora and qlora

* corrected yml files and removed tiny-llama.yml from llama-2 example

examples/tiny-llama/README.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Overview
2
+
3
+ This is a simple example of how to finetune TinyLlama1.1B using either lora or qlora:
4
+
5
+ LoRa:
6
+
7
+ ```
8
+ accelerate launch -m axolotl.cli.train examples/tiny-llama/lora.yml
9
+ ```
10
+
11
+ qLoRa:
12
+
13
+ ```
14
+ accelerate launch -m axolotl.cli.train examples/tiny-llama/qlora.yml
15
+ ```
16
+
17
+ Both take about 10 minutes to complete on a 4090.
examples/{llama-2/tiny-llama.yml → tiny-llama/lora.yml} RENAMED
@@ -1,5 +1,4 @@
1
- base_model: PY007/TinyLlama-1.1B-intermediate-step-715k-1.5T
2
-
3
  model_type: LlamaForCausalLM
4
  tokenizer_type: LlamaTokenizer
5
  is_llama_derived_model: true
@@ -17,6 +16,7 @@ output_dir: ./lora-out
17
 
18
  sequence_len: 4096
19
  sample_packing: true
 
20
 
21
  adapter: lora
22
  lora_model_dir:
@@ -55,7 +55,6 @@ flash_attention: true
55
 
56
  warmup_steps: 10
57
  evals_per_epoch: 4
58
- eval_table_size:
59
  saves_per_epoch: 1
60
  debug:
61
  deepspeed:
@@ -63,6 +62,4 @@ weight_decay: 0.0
63
  fsdp:
64
  fsdp_config:
65
  special_tokens:
66
- bos_token: "<s>"
67
- eos_token: "</s>"
68
- unk_token: "<unk>"
 
1
+ base_model: TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T
 
2
  model_type: LlamaForCausalLM
3
  tokenizer_type: LlamaTokenizer
4
  is_llama_derived_model: true
 
16
 
17
  sequence_len: 4096
18
  sample_packing: true
19
+ pad_to_sequence_len: true
20
 
21
  adapter: lora
22
  lora_model_dir:
 
55
 
56
  warmup_steps: 10
57
  evals_per_epoch: 4
 
58
  saves_per_epoch: 1
59
  debug:
60
  deepspeed:
 
62
  fsdp:
63
  fsdp_config:
64
  special_tokens:
65
+
 
 
examples/tiny-llama/qlora.yml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ base_model: TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T
2
+ model_type: LlamaForCausalLM
3
+ tokenizer_type: LlamaTokenizer
4
+ is_llama_derived_model: true
5
+
6
+ load_in_8bit: false
7
+ load_in_4bit: true
8
+ strict: false
9
+
10
+ datasets:
11
+ - path: mhenrichsen/alpaca_2k_test
12
+ type: alpaca
13
+ dataset_prepared_path:
14
+ val_set_size: 0.05
15
+ output_dir: ./qlora-out
16
+
17
+ adapter: qlora
18
+ lora_model_dir:
19
+
20
+ sequence_len: 4096
21
+ sample_packing: true
22
+ pad_to_sequence_len: true
23
+
24
+ lora_r: 32
25
+ lora_alpha: 16
26
+ lora_dropout: 0.05
27
+ lora_target_modules:
28
+ lora_target_linear: true
29
+ lora_fan_in_fan_out:
30
+
31
+ wandb_project:
32
+ wandb_entity:
33
+ wandb_watch:
34
+ wandb_name:
35
+ wandb_log_model:
36
+
37
+ gradient_accumulation_steps: 4
38
+ micro_batch_size: 2
39
+ num_epochs: 4
40
+ optimizer: paged_adamw_32bit
41
+ lr_scheduler: cosine
42
+ learning_rate: 0.0002
43
+
44
+ train_on_inputs: false
45
+ group_by_length: false
46
+ bf16: true
47
+ fp16: false
48
+ tf32: false
49
+
50
+ gradient_checkpointing: true
51
+ early_stopping_patience:
52
+ resume_from_checkpoint:
53
+ local_rank:
54
+ logging_steps: 1
55
+ xformers_attention:
56
+ flash_attention: true
57
+
58
+ warmup_steps: 10
59
+ evals_per_epoch: 4
60
+ saves_per_epoch: 1
61
+ debug:
62
+ deepspeed:
63
+ weight_decay: 0.0
64
+ fsdp:
65
+ fsdp_config:
66
+ special_tokens:
67
+