File size: 1,115 Bytes
df64241
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from dataclasses import dataclass


@dataclass
class TrainConfig:
    """Training hyperparameters (Qwen-style defaults for a ~4B model)."""

    # data
    seq_len: int = 4096
    batch_size: int = 4              # sequences per step on one GPU (tune to fit memory)


    # optimizer (AdamW)
    peak_lr: float = 4e-4
    min_lr: float = 4e-5
    betas: tuple = (0.9, 0.95)
    weight_decay: float = 0.1
    grad_clip: float = 1.0
    grad_accum: int = 1 

    # learning-rate schedule
    warmup_steps: int = 2000
    max_steps: int = 190_000
    # # optimizer (AdamW)
    # peak_lr: float = 3e-4
    # min_lr: float = 3e-5
    # betas: tuple = (0.9, 0.95)       # 0.95 is the LLM-pretraining convention
    # weight_decay: float = 0.1
    # grad_clip: float = 1.0

    # # learning-rate schedule
    # warmup_steps: int = 2000
    # max_steps: int = 100_000         # total training steps (set per run)

    # logging / checkpointing
    log_every: int = 10
    ckpt_every: int = 2000
    ckpt_dir: str = "/fsx/ajay-stu/ar-data/checkpoints"
    lr_horizon: int = 186_000        # LR schedule spans this many steps