Merge branch 'main' into refactor/rename-4b-to-gptq
Browse files- README.md +7 -6
- examples/falcon/config-7b-lora.yml +64 -0
- examples/falcon/config-7b.yml +64 -0
- src/axolotl/utils/models.py +1 -1
- src/axolotl/utils/validation.py +5 -5
README.md
CHANGED
@@ -14,12 +14,13 @@
|
|
14 |
|
15 |
## Axolotl supports
|
16 |
|
17 |
-
|
|
18 |
-
|
19 |
-
| llama
|
20 |
-
| Pythia
|
21 |
-
| cerebras | β
| β
| β | β | β | β |
|
22 |
-
| mpt
|
|
|
23 |
|
24 |
|
25 |
## Quickstart β‘
|
|
|
14 |
|
15 |
## Axolotl supports
|
16 |
|
17 |
+
| | fp16/fp32 | fp16/fp32 w/ lora | qlora | 4bit-quant | 4bit-quant w/flash attention | flash attention | xformers attention |
|
18 |
+
|---------|:----------|:------------------|------|------------|------------------------------|-----------------|--------------------|
|
19 |
+
| llama | β
| β
| β
| β
| β
| β
| β
|
|
20 |
+
| Pythia | β
| β
| β | β | β | β | β |
|
21 |
+
| cerebras | β
| β
| β | β | β | β | β |
|
22 |
+
| mpt | β
| β | β | β | β | β | β |
|
23 |
+
| falcon | β
| β | β | β | β | β | β |
|
24 |
|
25 |
|
26 |
## Quickstart β‘
|
examples/falcon/config-7b-lora.yml
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
base_model: tiiuae/falcon-7b
|
2 |
+
base_model_config: tiiuae/falcon-7b
|
3 |
+
trust_remote_code: true
|
4 |
+
model_type: AutoModelForCausalLM
|
5 |
+
tokenizer_type: AutoTokenizer
|
6 |
+
load_in_8bit: true
|
7 |
+
load_in_4bit: false
|
8 |
+
gptq: false
|
9 |
+
strict: false
|
10 |
+
push_dataset_to_hub:
|
11 |
+
datasets:
|
12 |
+
- path: teknium/GPT4-LLM-Cleaned
|
13 |
+
type: alpaca:chat
|
14 |
+
dataset_prepared_path: last_run_prepared
|
15 |
+
val_set_size: 0.01
|
16 |
+
adapter: lora
|
17 |
+
lora_model_dir:
|
18 |
+
sequence_len: 2048
|
19 |
+
max_packed_sequence_len:
|
20 |
+
lora_r: 16
|
21 |
+
lora_alpha: 32
|
22 |
+
lora_dropout: 0.0
|
23 |
+
lora_target_modules:
|
24 |
+
lora_target_linear: true
|
25 |
+
lora_fan_in_fan_out:
|
26 |
+
wandb_project: falcon-7b
|
27 |
+
wandb_watch:
|
28 |
+
wandb_run_id:
|
29 |
+
wandb_log_model:
|
30 |
+
output_dir: ./falcon-7b
|
31 |
+
batch_size: 2
|
32 |
+
micro_batch_size: 1
|
33 |
+
num_epochs: 4
|
34 |
+
optimizer: adamw_bnb_8bit
|
35 |
+
torchdistx_path:
|
36 |
+
lr_scheduler: cosine
|
37 |
+
learning_rate: 0.00003
|
38 |
+
train_on_inputs: false
|
39 |
+
group_by_length: false
|
40 |
+
bf16: true
|
41 |
+
fp16: false
|
42 |
+
tf32: true
|
43 |
+
gradient_checkpointing: true
|
44 |
+
early_stopping_patience:
|
45 |
+
resume_from_checkpoint:
|
46 |
+
local_rank:
|
47 |
+
logging_steps: 1
|
48 |
+
xformers_attention: true
|
49 |
+
flash_attention:
|
50 |
+
gptq_groupsize:
|
51 |
+
gptq_model_v1:
|
52 |
+
warmup_steps: 40
|
53 |
+
eval_steps: 5
|
54 |
+
save_steps: 43
|
55 |
+
debug:
|
56 |
+
deepspeed:
|
57 |
+
weight_decay: 0.0
|
58 |
+
fsdp:
|
59 |
+
fsdp_config:
|
60 |
+
special_tokens:
|
61 |
+
pad_token: "<|endoftext|>"
|
62 |
+
bos_token: ">>ABSTRACT<<"
|
63 |
+
eos_token: "<|endoftext|>"
|
64 |
+
|
examples/falcon/config-7b.yml
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
base_model: tiiuae/falcon-7b
|
2 |
+
base_model_config: tiiuae/falcon-7b
|
3 |
+
trust_remote_code: true
|
4 |
+
model_type: AutoModelForCausalLM
|
5 |
+
tokenizer_type: AutoTokenizer
|
6 |
+
load_in_8bit: false
|
7 |
+
load_in_4bit: false
|
8 |
+
gptq: false
|
9 |
+
strict: false
|
10 |
+
push_dataset_to_hub:
|
11 |
+
datasets:
|
12 |
+
- path: teknium/GPT4-LLM-Cleaned
|
13 |
+
type: alpaca:chat
|
14 |
+
dataset_prepared_path: last_run_prepared
|
15 |
+
val_set_size: 0.01
|
16 |
+
adapter:
|
17 |
+
lora_model_dir:
|
18 |
+
sequence_len: 2048
|
19 |
+
max_packed_sequence_len:
|
20 |
+
lora_r: 64
|
21 |
+
lora_alpha: 32
|
22 |
+
lora_dropout: 0.0
|
23 |
+
lora_target_modules:
|
24 |
+
lora_target_linear: true
|
25 |
+
lora_fan_in_fan_out:
|
26 |
+
wandb_project: falcon-7b
|
27 |
+
wandb_watch:
|
28 |
+
wandb_run_id:
|
29 |
+
wandb_log_model:
|
30 |
+
output_dir: ./falcon-7b
|
31 |
+
batch_size: 2
|
32 |
+
micro_batch_size: 1
|
33 |
+
num_epochs: 4
|
34 |
+
optimizer: adamw_bnb_8bit
|
35 |
+
torchdistx_path:
|
36 |
+
lr_scheduler: cosine
|
37 |
+
learning_rate: 0.00003
|
38 |
+
train_on_inputs: false
|
39 |
+
group_by_length: false
|
40 |
+
bf16: true
|
41 |
+
fp16: false
|
42 |
+
tf32: true
|
43 |
+
gradient_checkpointing: true
|
44 |
+
early_stopping_patience:
|
45 |
+
resume_from_checkpoint:
|
46 |
+
local_rank:
|
47 |
+
logging_steps: 1
|
48 |
+
xformers_attention: true
|
49 |
+
flash_attention:
|
50 |
+
gptq_groupsize:
|
51 |
+
gptq_model_v1:
|
52 |
+
warmup_steps: 40
|
53 |
+
eval_steps: 5
|
54 |
+
save_steps: 43
|
55 |
+
debug:
|
56 |
+
deepspeed:
|
57 |
+
weight_decay: 0.0
|
58 |
+
fsdp:
|
59 |
+
fsdp_config:
|
60 |
+
special_tokens:
|
61 |
+
pad_token: "<|endoftext|>"
|
62 |
+
bos_token: ">>ABSTRACT<<"
|
63 |
+
eos_token: "<|endoftext|>"
|
64 |
+
|
src/axolotl/utils/models.py
CHANGED
@@ -364,7 +364,7 @@ def load_lora(model, cfg):
|
|
364 |
PeftModel,
|
365 |
)
|
366 |
|
367 |
-
lora_target_modules = list(cfg.lora_target_modules)
|
368 |
|
369 |
if cfg.lora_target_linear:
|
370 |
bits = None
|
|
|
364 |
PeftModel,
|
365 |
)
|
366 |
|
367 |
+
lora_target_modules = list(cfg.lora_target_modules or [])
|
368 |
|
369 |
if cfg.lora_target_linear:
|
370 |
bits = None
|
src/axolotl/utils/validation.py
CHANGED
@@ -8,12 +8,12 @@ def validate_config(cfg):
|
|
8 |
if cfg.adapter == "qlora":
|
9 |
if cfg.merge_lora:
|
10 |
# can't merge qlora if loaded in 8bit or 4bit
|
11 |
-
assert cfg.load_in_8bit is
|
12 |
-
assert cfg.gptq is
|
13 |
-
assert cfg.load_in_4bit is
|
14 |
else:
|
15 |
-
assert cfg.load_in_8bit is
|
16 |
-
assert cfg.gptq is
|
17 |
assert cfg.load_in_4bit is True
|
18 |
|
19 |
if not cfg.load_in_8bit and cfg.adapter == "lora":
|
|
|
8 |
if cfg.adapter == "qlora":
|
9 |
if cfg.merge_lora:
|
10 |
# can't merge qlora if loaded in 8bit or 4bit
|
11 |
+
assert cfg.load_in_8bit is not True
|
12 |
+
assert cfg.gptq is not True
|
13 |
+
assert cfg.load_in_4bit is not True
|
14 |
else:
|
15 |
+
assert cfg.load_in_8bit is not True
|
16 |
+
assert cfg.gptq is not True
|
17 |
assert cfg.load_in_4bit is True
|
18 |
|
19 |
if not cfg.load_in_8bit and cfg.adapter == "lora":
|