Create config.yaml
Browse files- config.yaml +79 -0
config.yaml
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
output_dir: /home/jupyter/datasphere/alignment/output
|
| 2 |
+
|
| 3 |
+
# Model Arguments
|
| 4 |
+
model:
|
| 5 |
+
_component_: torchtune.models.gemma2.lora_gemma2_9b
|
| 6 |
+
lora_attn_modules: ['q_proj', 'v_proj', 'output_proj']
|
| 7 |
+
apply_lora_to_mlp: True
|
| 8 |
+
lora_rank: 8 # higher increases accuracy and memory
|
| 9 |
+
lora_alpha: 16 # usually alpha=2*rank
|
| 10 |
+
lora_dropout: 0.0
|
| 11 |
+
|
| 12 |
+
# Tokenizer
|
| 13 |
+
tokenizer:
|
| 14 |
+
_component_: torchtune.models.gemma.gemma_tokenizer
|
| 15 |
+
path: /home/jupyter/datasphere/alignment/epoch2/tokenizer.model
|
| 16 |
+
max_seq_len: 1024 # higher increases memory
|
| 17 |
+
|
| 18 |
+
checkpointer:
|
| 19 |
+
_component_: torchtune.training.FullModelHFCheckpointer
|
| 20 |
+
checkpoint_dir: /home/jupyter/datasphere/alignment/epoch2/
|
| 21 |
+
checkpoint_files: [
|
| 22 |
+
ft-model-00001-of-00004.safetensors,
|
| 23 |
+
ft-model-00002-of-00004.safetensors,
|
| 24 |
+
ft-model-00003-of-00004.safetensors,
|
| 25 |
+
ft-model-00004-of-00004.safetensors
|
| 26 |
+
]
|
| 27 |
+
recipe_checkpoint: null
|
| 28 |
+
output_dir: ${output_dir}
|
| 29 |
+
model_type: GEMMA2
|
| 30 |
+
resume_from_checkpoint: False
|
| 31 |
+
save_adapter_weights_only: False
|
| 32 |
+
|
| 33 |
+
# Dataset and Sampler
|
| 34 |
+
dataset:
|
| 35 |
+
_component_: torchtune.datasets.preference_dataset
|
| 36 |
+
source: json
|
| 37 |
+
data_files: /home/jupyter/datasphere/alignment/data/convo_dpo.json
|
| 38 |
+
column_map:
|
| 39 |
+
chosen: chosen_conversations
|
| 40 |
+
rejected: rejected_conversations
|
| 41 |
+
train_on_input: False
|
| 42 |
+
split: train
|
| 43 |
+
seed: null
|
| 44 |
+
shuffle: True
|
| 45 |
+
batch_size: 4
|
| 46 |
+
|
| 47 |
+
# Optimizer and Scheduler
|
| 48 |
+
optimizer:
|
| 49 |
+
_component_: torch.optim.AdamW
|
| 50 |
+
fused: True
|
| 51 |
+
weight_decay: 0.05
|
| 52 |
+
lr: 5e-4
|
| 53 |
+
lr_scheduler:
|
| 54 |
+
_component_: torchtune.training.lr_schedulers.get_cosine_schedule_with_warmup
|
| 55 |
+
num_warmup_steps: 100
|
| 56 |
+
|
| 57 |
+
loss:
|
| 58 |
+
_component_: torchtune.rlhf.loss.SimPOLoss
|
| 59 |
+
|
| 60 |
+
# Training
|
| 61 |
+
epochs: 3
|
| 62 |
+
max_steps_per_epoch: 1000
|
| 63 |
+
gradient_accumulation_steps: 8 # Use to increase effective batch size
|
| 64 |
+
compile: False # torch.compile the model + loss, True increases speed + decreases memory
|
| 65 |
+
|
| 66 |
+
# Logging
|
| 67 |
+
metric_logger:
|
| 68 |
+
_component_: torchtune.training.metric_logging.DiskLogger
|
| 69 |
+
log_dir: ${output_dir}/logs
|
| 70 |
+
log_every_n_steps: 1
|
| 71 |
+
log_peak_memory_stats: True
|
| 72 |
+
|
| 73 |
+
# Environment
|
| 74 |
+
device: cuda
|
| 75 |
+
dtype: bf16
|
| 76 |
+
|
| 77 |
+
# Memory management
|
| 78 |
+
enable_activation_checkpointing: True # True reduces memory
|
| 79 |
+
enable_activation_offloading: False # True reduces memory
|