ViuAI commited on
Commit
bea1ed2
·
verified ·
1 Parent(s): 9d0f9ca

Fix CUDA OOM on T4: cast model to amp_dtype directly, batch_size=2, safe RMSNorm

Browse files
.gitattributes CHANGED
@@ -4,4 +4,3 @@
4
  *.onnx filter=lfs diff=lfs merge=lfs -text
5
  tokenizer/outputs/*.json filter=lfs diff=lfs merge=lfs -text
6
  data/processed/* filter=lfs diff=lfs merge=lfs -text
7
- data/processed_romance_chat/train-p1p2_boost_casual_and_empathetic_chat-00000.parquet filter=lfs diff=lfs merge=lfs -text
 
4
  *.onnx filter=lfs diff=lfs merge=lfs -text
5
  tokenizer/outputs/*.json filter=lfs diff=lfs merge=lfs -text
6
  data/processed/* filter=lfs diff=lfs merge=lfs -text
 
model/configs/train_h100_h200.yaml ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Pretraining config — VIU-1.5B MoE 48L (1.856B total / 300.5M active)
2
+ # OPTIMIZED FOR ENTERPRISE CLOUD NVIDIA H100 (80GB SXM5/PCIe) & H200 (141GB HBM3e)
3
+ # Supports Single-GPU or Multi-GPU (e.g. 8x H100 / 8x H200 DGX nodes with NVLink)
4
+ seed: 42
5
+ data_dir: ../../data/raw
6
+ tokenizer_path: ../../tokenizer/outputs/tokenizer.json
7
+
8
+ # Sequence Length Curriculum:
9
+ # Stage 1: 0 to 50k steps (seq 512, maximum throughput on massive HBM3e bandwidth)
10
+ # Stage 2: 50k to 200k steps (seq 1024, mid-length reasoning & conversations)
11
+ # Stage 3: 200k+ steps to completion (seq 2048, full long-context mastery)
12
+ # Global effective batch is kept strictly constant at 262,144 tokens per step across all stages!
13
+ curriculum: true
14
+ curriculum_stages:
15
+ - max_step: 50000
16
+ seq_len: 512
17
+ batch_size: 32
18
+ grad_accum: 16 # 512 * 32 * 16 = 262,144 tokens/step (per node / single-GPU)
19
+ - max_step: 200000
20
+ seq_len: 1024
21
+ batch_size: 16
22
+ grad_accum: 16 # 1024 * 16 * 16 = 262,144 tokens/step
23
+ - max_step: null
24
+ seq_len: 2048
25
+ batch_size: 8
26
+ grad_accum: 16 # 2048 * 8 * 16 = 262,144 tokens/step
27
+
28
+ seq_len: 1024
29
+ train_split: 0.95
30
+
31
+ # H100 (80GB) / H200 (141GB): Massive VRAM allows NO gradient checkpointing (33% faster backprop!)
32
+ batch_size: 16
33
+ grad_accum: 16
34
+ target_global_batch: 256
35
+ auto_tune: false
36
+
37
+ # FULL PRETRAINING: Dynamic Auto-Steps from 125B+ Tokens (2,109 Parquet files on Hub)
38
+ total_tokens: 126500000000 # 126.5B authentic tokens
39
+ max_steps: auto # Automatically computed: total_tokens // (batch_size * grad_accum * seq_len)
40
+ lr: 3.0e-04
41
+ min_lr: 3.0e-05
42
+ warmup_steps: 15000
43
+ weight_decay: 0.1
44
+ betas: [0.9, 0.95]
45
+ grad_clip: 1.0
46
+
47
+ # Native Hopper BF16 precision + Muon
48
+ amp: bf16
49
+ optimizer: muon
50
+ muon_lr: 0.02
51
+ muon_momentum: 0.95
52
+ muon_weight_decay: 0.01
53
+ # With 80GB-141GB VRAM, grad_ckpt can be false to save recomputation overhead
54
+ grad_ckpt: false
55
+
56
+ compile: false
57
+ compile_mode: reduce-overhead
58
+ fp8: false # Can be set to true on H100/H200 if torchao is installed
59
+
60
+ eval_every: 1000
61
+ save_every: 1000
62
+ log_every: 25
63
+ ckpt_dir: ../checkpoints
64
+ log_dir: ../../logs
65
+
66
+ # Checkpoint auto-push to Hugging Face Hub (background non-blocking thread)
67
+ hf_push: true
68
+ hf_repo: ViuAI/Viu-1.5B-MoE
69
+ hf_push_every: 0
70
+ hf_push_full_every: 1000
71
+ keep_local_full: 2
72
+ keep_remote_full: 3
73
+ resume: auto
74
+ sample_every: 500
75
+ sample_prompt: "bhai kal party me kya scene hai"
76
+
77
+ # Zero-Disk Streaming from Hub (pure PyArrow memory-mapped buffer, ~300MB RAM)
78
+ hf_dataset: ViuAI/viu-mini-raw-pretrain
79
+ hf_max_blocks: 50000
80
+ hf_safety: full
81
+ hf_max_rows: null
82
+ enforce_mix: true
83
+ lang_mix:
84
+ hinglish: 0.15
85
+ hindi: 0.35
86
+ english: 0.5
87
+ natural_shuffle_buffer: 50000
88
+ hf_round: 0
89
+ hf_round_rows: 200000
model/configs/train_rtx3090.yaml ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Pretraining config — VIU-1.5B MoE 48L (1.856B total / 300.5M active)
2
+ # OPTIMIZED FOR SINGLE / MULTI NVIDIA GEFORCE RTX 3090 (24GB GDDR6X, Ampere cc 8.6)
3
+ seed: 42
4
+ data_dir: ../../data/raw
5
+ tokenizer_path: ../../tokenizer/outputs/tokenizer.json
6
+
7
+ # Sequence Length Curriculum:
8
+ # Stage 1: 0 to 50k steps (seq 512, ~2.5x higher throughput)
9
+ # Stage 2: 50k to 200k steps (seq 1024, mid-length reasoning & conversations)
10
+ # Stage 3: 200k+ steps to completion (seq 2048, full long-context mastery)
11
+ # Global effective batch is kept strictly constant at 262,144 tokens per step across all stages!
12
+ curriculum: true
13
+ curriculum_stages:
14
+ - max_step: 50000
15
+ seq_len: 512
16
+ batch_size: 8
17
+ grad_accum: 64 # 512 * 8 * 64 = 262,144 tokens/step
18
+ - max_step: 200000
19
+ seq_len: 1024
20
+ batch_size: 4
21
+ grad_accum: 64 # 1024 * 4 * 64 = 262,144 tokens/step
22
+ - max_step: null
23
+ seq_len: 2048
24
+ batch_size: 2
25
+ grad_accum: 64 # 2048 * 2 * 64 = 262,144 tokens/step
26
+
27
+ seq_len: 1024
28
+ train_split: 0.95
29
+
30
+ # RTX 3090 24GB: micro-batch 4-8 with SDPA/FlashAttention-2 and PagedAdamW8bit (leaves ~8 GB safety headroom)
31
+ batch_size: 4
32
+ grad_accum: 64
33
+ target_global_batch: 256
34
+ auto_tune: false
35
+
36
+ # FULL PRETRAINING: Dynamic Auto-Steps from 125B+ Tokens (2,109 Parquet files on Hub)
37
+ total_tokens: 126500000000 # 126.5B authentic tokens
38
+ max_steps: auto # Automatically computed: total_tokens // (batch_size * grad_accum * seq_len)
39
+ lr: 3.0e-04
40
+ min_lr: 3.0e-05
41
+ warmup_steps: 15000
42
+ weight_decay: 0.1
43
+ betas: [0.9, 0.95]
44
+ grad_clip: 1.0
45
+
46
+ # Native Ampere BF16 precision + Muon + Grad Ckpt
47
+ amp: bf16
48
+ optimizer: muon
49
+ muon_lr: 0.02
50
+ muon_momentum: 0.95
51
+ muon_weight_decay: 0.01
52
+ grad_ckpt: true
53
+
54
+ compile: false
55
+ compile_mode: reduce-overhead
56
+ fp8: false
57
+
58
+ eval_every: 1000
59
+ save_every: 1000
60
+ log_every: 25
61
+ ckpt_dir: ../checkpoints
62
+ log_dir: ../../logs
63
+
64
+ # Checkpoint auto-push to Hugging Face Hub (background non-blocking thread)
65
+ hf_push: true
66
+ hf_repo: ViuAI/Viu-1.5B-MoE
67
+ hf_push_every: 0
68
+ hf_push_full_every: 1000
69
+ keep_local_full: 2
70
+ keep_remote_full: 3
71
+ resume: auto
72
+ sample_every: 500
73
+ sample_prompt: "bhai kal party me kya scene hai"
74
+
75
+ # Zero-Disk Streaming from Hub (pure PyArrow memory-mapped buffer, ~300MB RAM)
76
+ hf_dataset: ViuAI/viu-mini-raw-pretrain
77
+ hf_max_blocks: 50000
78
+ hf_safety: full
79
+ hf_max_rows: null
80
+ enforce_mix: true
81
+ lang_mix:
82
+ hinglish: 0.15
83
+ hindi: 0.35
84
+ english: 0.5
85
+ natural_shuffle_buffer: 50000
86
+ hf_round: 0
87
+ hf_round_rows: 200000