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