1# === Start-up Commands ===
2# curl -LsSf https://astral.sh/uv/install.sh | sh
3# export PATH="$HOME/.local/bin:$PATH"
4# git clone https://github.com/axolotl-ai-cloud/axolotl
5# cd axolotl
6# git checkout d8b4027200de0fe60f4ae0a71272c1a8cb2888f7
7# uv venv
8# source .venv/bin/activate
9# uv pip install packaging ninja setuptools ftfy huggingface_hub[cli,hf_transfer]
10# uv pip install "cut-cross-entropy[transformers] @ git+https://github.com/strangedove/ml-cross-entropy.git"
11# uv pip install apollo-torch
12# uv pip install --no-build-isolation -e .[flash-attn,deepspeed]
13# uv pip install git+https://github.com/huggingface/transformers.git
14# export HF_HUB_ENABLE_HF_TRANSFER=1
15# huggingface-cli login --token $hf_key && wandb login $wandb_key
16# axolotl preprocess qwen21-pretrain.yml
17# axolotl train qwen21-pretrain.yml
18
19# curl -LsSf https://astral.sh/uv/install.sh | sh && export PATH="$HOME/.local/bin:$PATH" && git clone https://github.com/axolotl-ai-cloud/axolotl && uv venv && source .venv/bin/activate && cd axolotl && uv pip install torch==2.5.1 packaging ninja setuptools ftfy deepspeed huggingface_hub[cli,hf_transfer] && uv pip install "cut-cross-entropy[transformers] @ git+https://github.com/strangedove/ml-cross-entropy.git" && uv pip install apollo-torch && uv pip install --no-build-isolation -e .[flash-attn] && uv pip install git+https://github.com/huggingface/transformers.git && export HF_HUB_ENABLE_HF_TRANSFER=1 && cd .. && huggingface-cli login --token $hf_key && wandb login $wandb_key
20
21# === Model Configuration ===
22base_model: unsloth/gemma-3-12b-it
23load_in_8bit: false
24load_in_4bit: true
25
26# === HF Configuration ===
27hub_model_id: ToastyPigeon/g3-12b-it-rp-qlora
28hub_strategy: "every_save"
29
30# === Training Setup ===
31num_epochs: 1
32micro_batch_size: 2
33gradient_accumulation_steps: 2
34sequence_len: 8192
35sample_packing: true
36pad_to_sequence_len: true
37
38# === Evaluation ===
39val_set_size: 100
40evals_per_epoch: 5
41#eval_table_size:
42eval_max_new_tokens: 256
43eval_sample_packing: true
44#eval_strategy: "no"
45
46# === LoRA Configuration ===
47adapter: qlora
48lora_model_dir:
49lora_r: 64
50lora_alpha: 64
51lora_dropout: 0.5
52lora_target_linear:
53lora_fan_in_fan_out:
54lora_target_modules:
55 - gate_proj
56 - down_proj
57 - up_proj
58 - q_proj
59 - v_proj
60 - k_proj
61 - o_proj
62
63#lora_mlp_kernel: true
64#lora_qkv_kernel: true
65#lora_o_kernel: true
66
67# === Hyperparameter Configuration ===
68#optimizer: apollo_adamw_layerwise
69optimizer: paged_adamw_8bit
70# Apollo-mini configuration:
71#optim_args: "proj=random,rank=1,scale=128.0,scale_type=tensor,update_proj_gap=200"
72# Regular Apollo configuration:
73# optim_args:
74#optim_target_modules: all_linear
75learning_rate: 1e-5
76lr_scheduler: rex
77weight_decay: 0.01
78#warmup_ratio: 0.05
79
80
81# === Data Configuration ===
82#chat_template: jinja
83#chat_template_jinja: "{{ bos_token }}{% for message in messages %}{% if (message['role'] == 'assistant') %}{% set role = 'model' %}{% else %}{% set role = message['role'] %}{% endif %}{{ '<start_of_turn>' + role + '\n' + message['content'] | trim + '<end_of_turn>\n' }}{% endfor %}{% if add_generation_prompt %}{{'<start_of_turn>model\n'}}{% endif %}"
84#special_tokens:
85# eos_token: "<end_of_turn>"
86shuffle_merged_datasets: true
87datasets:
88 - path: ToastyPigeon/some-rp-extended
89 type: customgemma-regex
90 - path: allura-org/inkstructmix-v0.2.1a-system-reasoning-separated
91 type: customgemma-regex
92 data_files: inkstruct-system.json
93 split: train[:750]
94 - path: ToastyPigeon/unalign-v2
95 type: customgemma-regex
96 - path: ToastyPigeon/synth-rp
97 split: train[:1200]
98 type: customgemma-regex
99
100dataset_prepared_path: last_run_prepared
101
102
103# === Plugins ===
104plugins:
105 - axolotl.integrations.liger.LigerPlugin
106 - axolotl.integrations.cut_cross_entropy.CutCrossEntropyPlugin
107
108# === Hardware Optimization ===
109gradient_checkpointing: true
110#gradient_checkpointing_kwargs:
111# use_reentrant: true
112liger_rope: true
113liger_rms_norm: true
114liger_glu_activation: true
115#liger_fused_linear_cross_entropy: true
116#unsloth_cross_entropy_loss: true
117cut_cross_entropy: true
118# Only if using multiple GPUs:
119deepspeed: axolotl/deepspeed_configs/zero2.json
120
121# === Wandb Tracking ===
122wandb_project: Gemma
123# wandb_entity: [WANDB_ENTITY]
124# wandb_name: [WANDB_RUN_NAME]
125
126# === Checkpointing ===
127saves_per_epoch: 10
128save_total_limit: 1
129
130# === Advanced Settings ===
131output_dir: ./ckpts
132bf16: auto
133flash_attention: true
134train_on_inputs: false
135group_by_length: false
136save_safetensors: true
137logging_steps: 1
138gc_steps: 10
139seed: 69