Nanthasit commited on
Commit
223a221
·
verified ·
1 Parent(s): e04e3dc

Tune 0.5b v7 job for H200: batch 64, lr 4e-4, 3 epochs, no grad checkpointing

Browse files
Files changed (1) hide show
  1. job-0.5b-v7.py +12 -4
job-0.5b-v7.py CHANGED
@@ -112,12 +112,20 @@ model = get_peft_model(model, LoraConfig(
112
  r=16, lora_alpha=32, lora_dropout=0.05, bias="none", task_type="CAUSAL_LM", use_rslora=True,
113
  target_modules=["q_proj","k_proj","v_proj","o_proj","gate_proj","up_proj","down_proj"]))
114
  model.print_trainable_parameters()
115
- args = SFTConfig(output_dir="out-0.5b-v2", num_train_epochs=2, per_device_train_batch_size=8,
116
- gradient_accumulation_steps=2, learning_rate=2e-4,
117
- lr_scheduler_type="cosine", warmup_ratio=0.03, logging_steps=10,
 
 
 
 
 
 
 
 
118
  save_strategy="no", bf16=True, max_length=MAX_LEN, packing=False,
119
  dataset_text_field="text", push_to_hub=False, report_to="none",
120
- run_name="sakthai-0.5b-v2-mlp-rslora-v7")
121
  trainer = SFTTrainer(model=model, args=args, train_dataset=train_ds, processing_class=tokenizer)
122
  trainer.train()
123
 
 
112
  r=16, lora_alpha=32, lora_dropout=0.05, bias="none", task_type="CAUSAL_LM", use_rslora=True,
113
  target_modules=["q_proj","k_proj","v_proj","o_proj","gate_proj","up_proj","down_proj"]))
114
  model.print_trainable_parameters()
115
+ # Tuned for a single H200 (141 GB): batch 64 in one go instead of 8x2 accumulation.
116
+ # That is a 4x larger effective batch, so the LR is sqrt-scaled 2e-4 -> 4e-4 and
117
+ # warmup widened to 10% (the step count is small enough that 3% was ~3 steps).
118
+ # 3 epochs rather than 2 buys back optimizer steps (66 -> 99) that the big batch
119
+ # costs, and on this hardware the extra epoch is nearly free.
120
+ # Gradient checkpointing is off: with 141 GB there is no reason to trade compute
121
+ # for memory, and it is worth ~30% throughput.
122
+ args = SFTConfig(output_dir="out-0.5b-v2", num_train_epochs=3, per_device_train_batch_size=64,
123
+ gradient_accumulation_steps=1, learning_rate=4e-4,
124
+ gradient_checkpointing=False,
125
+ lr_scheduler_type="cosine", warmup_ratio=0.1, logging_steps=5,
126
  save_strategy="no", bf16=True, max_length=MAX_LEN, packing=False,
127
  dataset_text_field="text", push_to_hub=False, report_to="none",
128
+ run_name="sakthai-0.5b-v2-mlp-rslora-v7-h200")
129
  trainer = SFTTrainer(model=model, args=args, train_dataset=train_ds, processing_class=tokenizer)
130
  trainer.train()
131