tisu1902 commited on
Commit
043f967
·
verified ·
1 Parent(s): a0f0a12
Files changed (1) hide show
  1. README.md +62 -0
README.md CHANGED
@@ -25,3 +25,65 @@ https://huggingface.co/datasets/tisu1902/var-full-no-think
25
 
26
  ## Wandb
27
  https://wandb.ai/quangphamm1902/huggingface/runs/4bv2nr1q?nw=nwuserquangphamm1902
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  ## Wandb
27
  https://wandb.ai/quangphamm1902/huggingface/runs/4bv2nr1q?nw=nwuserquangphamm1902
28
+
29
+ ```
30
+ from trl import SFTTrainer, SFTConfig
31
+
32
+ trainer = SFTTrainer(
33
+ model=model,
34
+ tokenizer=tokenizer,
35
+ train_dataset=train_dataset,
36
+ eval_dataset=val_dataset,
37
+ args=SFTConfig(
38
+ dataset_text_field="text",
39
+ max_seq_length=18432,
40
+
41
+ # Reduce effective batch for more steps
42
+ per_device_train_batch_size=4, # Down from 6
43
+ gradient_accumulation_steps=2, # Down from 6
44
+ # Effective batch = 8 (instead of 36)
45
+ # New steps per epoch = 410 / 8 ≈ 51
46
+ # Total steps = 51 × 3 = 153 steps
47
+ per_device_eval_batch_size=1,
48
+
49
+ # Training
50
+ num_train_epochs=3,
51
+ learning_rate=1e-4,
52
+ warmup_ratio=0.1,
53
+ lr_scheduler_type="cosine",
54
+
55
+ # Optimization
56
+ optim="adamw_8bit",
57
+ weight_decay=0.01,
58
+ max_grad_norm=0.3,
59
+
60
+ # Memory
61
+ fp16=not torch.cuda.is_bf16_supported(),
62
+ bf16=torch.cuda.is_bf16_supported(),
63
+ gradient_checkpointing=True,
64
+
65
+ # Evaluation & Saving - ADJUSTED FOR FEWER STEPS
66
+ eval_strategy="steps",
67
+ eval_steps=25,
68
+ save_strategy="steps",
69
+ save_steps=25,
70
+ save_total_limit=3,
71
+ load_best_model_at_end=True,
72
+ metric_for_best_model="eval_loss",
73
+ greater_is_better=False,
74
+
75
+ # Logging
76
+ logging_steps=5,
77
+ logging_first_step=True,
78
+
79
+ # Other
80
+ seed=3407,
81
+ output_dir="outputs",
82
+ remove_unused_columns=False,
83
+
84
+ # TRL specific
85
+ dataset_num_proc=4,
86
+ packing=False,
87
+ ),
88
+ )
89
+ ```