-
Notifications
You must be signed in to change notification settings - Fork 220
Expand file tree
/
Copy pathmegatron_pretrain_moonlight_16b_te_slurm.yaml
More file actions
118 lines (100 loc) · 3.62 KB
/
Copy pathmegatron_pretrain_moonlight_16b_te_slurm.yaml
File metadata and controls
118 lines (100 loc) · 3.62 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# To run this recipe:
# cp slurm.sub my_cluster.sub
# # In my_cluster.sub, set CONFIG to this file and request 1 node x 8 GPUs.
# sbatch my_cluster.sub
# This config uses dp_size=8 and ep_size=8, so the configured world size is 8 GPUs.
recipe: TrainFinetuneRecipeForNextTokenPrediction
step_scheduler:
global_batch_size: 512
local_batch_size: 2
ckpt_every_steps: 500
val_every_steps: 100 # will run every x number of gradient steps
num_epochs: 1
max_steps: 9500
dist_env:
backend: nccl
timeout_minutes: 10
rng:
_target_: nemo_automodel.components.training.rng.StatefulRNG
seed: 1111
ranked: true
model:
_target_: nemo_automodel.NeMoAutoModelForCausalLM.from_config
torch_dtype: float32
config:
_target_: transformers.AutoConfig.from_pretrained
pretrained_model_name_or_path: moonshotai/Moonlight-16B-A3B
checkpoint:
enabled: true
checkpoint_dir: checkpoints/
model_save_format: torch_save # torch_save or safetensors
save_consolidated: false
distributed:
strategy: fsdp2
tp_size: 1
cp_size: 1
pp_size: 1
dp_size: 8
ep_size: 8
loss_fn:
_target_: nemo_automodel.components.loss.linear_ce.FusedLinearCrossEntropy
dataset:
_target_: nemo_automodel.components.datasets.llm.megatron_dataset.MegatronPretraining
paths: /path/to/fineweb_edu/processed_data_*_text_document* # REPLACE THIS
index_mapping_dir: /path/to/fineweb_edu/mapping_dir # REPLACE THIS
tokenizer:
_target_: nemo_automodel._transformers.auto_tokenizer.NeMoAutoTokenizer.from_pretrained
pretrained_model_name_or_path: moonshotai/Moonlight-16B-A3B
trust_remote_code: true
seq_length: 2048
split: "0.99, 0.01, 0.00" # train, validation, test
splits_to_build: "train" # has to be one of train, validation, test
dataloader:
_target_: torchdata.stateful_dataloader.StatefulDataLoader
collate_fn: torch.utils.data.default_collate
dataloader_type: "single" # or "cyclic"
validation_dataset:
_target_: nemo_automodel.components.datasets.llm.megatron_dataset.MegatronPretraining
paths: /path/to/fineweb_edu/processed_data_*_text_document* # REPLACE THIS
index_mapping_dir: /path/to/fineweb_edu/mapping_dir # REPLACE THIS
tokenizer:
_target_: nemo_automodel._transformers.auto_tokenizer.NeMoAutoTokenizer.from_pretrained
pretrained_model_name_or_path: moonshotai/Moonlight-16B-A3B
trust_remote_code: true
seq_length: 2048
split: "0.99, 0.01, 0.00" # train, validation, test
splits_to_build: "validation" # has to be one of train, validation, test
num_val_samples: 1024
validation_dataloader:
_target_: torchdata.stateful_dataloader.StatefulDataLoader
collate_fn: torch.utils.data.default_collate
dataloader_type: "single"
optimizer:
_target_: torch.optim.AdamW
betas: [0.9, 0.95]
eps: 1e-5
lr: 4.2e-4
weight_decay: 0.1
lr_scheduler:
lr_decay_style: cosine
lr_warmup_steps: 500
min_lr: 0.0
# Uncomment and configure for W&B logging
# wandb:
# project: <your_wandb_project>
# entity: <your_wandb_entity>
# name: <your_wandb_exp_name>
# save_dir: <your_wandb_save_dir>