Last active
December 13, 2023 10:49
-
-
Save theycallmeloki/b6053733e2a2f35cca65cfed61ecf134 to your computer and use it in GitHub Desktop.
Axolotl finetune mistral (miladyos)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
agent any | |
stages { | |
stage('Run Training Session') { | |
agent { | |
docker { | |
image 'winglian/axolotl:main-py3.10-cu118-2.0.1' | |
args '--privileged --gpus all --shm-size 10g --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 --mount type=volume,src=axolotl,target=/workspace/axolotl -v ${HOME}/.cache/huggingface:/root/.cache/huggingface' | |
} | |
} | |
steps { | |
sh 'ls -lh' | |
sh 'pwd' | |
writeFile file: 'qlora.yml', text: ''' | |
base_model: mistralai/Mistral-7B-v0.1 | |
model_type: MistralForCausalLM | |
tokenizer_type: LlamaTokenizer | |
is_mistral_derived_model: true | |
load_in_8bit: false | |
load_in_4bit: true | |
strict: false | |
eval_sample_packing: false | |
datasets: | |
- path: linpang/alpaca_html | |
type: alpaca | |
dataset_prepared_path: last_run_prepared | |
val_set_size: 0.05 | |
output_dir: ./qlora-out | |
adapter: qlora | |
lora_model_dir: | |
sequence_len: 8192 | |
sample_packing: false | |
pad_to_sequence_len: true | |
lora_r: 32 | |
lora_alpha: 16 | |
lora_dropout: 0.05 | |
lora_target_linear: true | |
lora_fan_in_fan_out: | |
lora_target_modules: | |
- gate_proj | |
- down_proj | |
- up_proj | |
- q_proj | |
- v_proj | |
- k_proj | |
- o_proj | |
wandb_project: | |
wandb_entity: | |
wandb_watch: | |
wandb_name: | |
wandb_log_model: | |
gradient_accumulation_steps: 4 | |
micro_batch_size: 2 | |
num_epochs: 1 | |
optimizer: adamw_bnb_8bit | |
lr_scheduler: cosine | |
learning_rate: 0.0002 | |
train_on_inputs: false | |
group_by_length: false | |
bf16: true | |
fp16: false | |
tf32: false | |
gradient_checkpointing: true | |
early_stopping_patience: | |
resume_from_checkpoint: | |
local_rank: | |
logging_steps: 1 | |
xformers_attention: | |
flash_attention: true | |
loss_watchdog_threshold: 5.0 | |
loss_watchdog_patience: 3 | |
warmup_steps: 10 | |
eval_steps: 0.05 | |
eval_table_size: | |
eval_table_max_new_tokens: 128 | |
save_steps: | |
debug: | |
deepspeed: | |
weight_decay: 0.0 | |
fsdp: | |
fsdp_config: | |
special_tokens: | |
bos_token: "<s>" | |
eos_token: "</s>" | |
unk_token: "<unk>" | |
''' | |
writeFile file: 'zero2.json', text: ''' | |
{ | |
"zero_optimization": { | |
"stage": 2, | |
"offload_optimizer": { | |
"device": "cpu" | |
}, | |
"contiguous_gradients": true, | |
"overlap_comm": true | |
}, | |
"bf16": { | |
"enabled": "auto" | |
}, | |
"fp16": { | |
"enabled": "auto", | |
"auto_cast": false, | |
"loss_scale": 0, | |
"initial_scale_power": 32, | |
"loss_scale_window": 1000, | |
"hysteresis": 2, | |
"min_loss_scale": 1 | |
}, | |
"gradient_accumulation_steps": "auto", | |
"train_batch_size": "auto", | |
"train_micro_batch_size_per_gpu": "auto", | |
"wall_clock_breakdown": false | |
} | |
''' | |
sh 'ACCELERATE_USE_DEEPSPEED=true accelerate launch -m axolotl.cli.train qlora.yml --deepspeed zero2.json' | |
} | |
} | |
} | |
post { | |
always { | |
echo 'Cleaning up...' | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment