Skip to content

Commit f8d318a

Browse files
committed
120b long context recipe
Signed-off-by: Maanu Grover <maanug@nvidia.com>
1 parent 14536db commit f8d318a

4 files changed

Lines changed: 48 additions & 0 deletions

File tree

‎src/megatron/bridge/recipes/gpt_oss/__init__.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
gpt_oss_20b_sft_openmathinstruct2_thinking_packed_config,
2727
gpt_oss_120b_peft_config,
2828
gpt_oss_120b_pretrain_config,
29+
gpt_oss_120b_sft_32k_config,
2930
gpt_oss_120b_sft_config,
3031
)
3132

@@ -34,6 +35,7 @@
3435
"gpt_oss_20b_pretrain_config",
3536
"gpt_oss_20b_pretrain_fp8_current_scaling_config",
3637
"gpt_oss_120b_pretrain_config",
38+
"gpt_oss_120b_sft_32k_config",
3739
"gpt_oss_20b_sft_config",
3840
"gpt_oss_20b_sft_32k_config",
3941
"gpt_oss_20b_sft_openmathinstruct2_thinking_packed_config",

‎src/megatron/bridge/recipes/gpt_oss/gpt_oss.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,15 @@
6262
from megatron.bridge.recipes.gpt_oss.h100.gpt_oss import (
6363
gpt_oss_120b_sft_32gpu_h100_bf16_config as gpt_oss_120b_sft_config,
6464
)
65+
from megatron.bridge.recipes.gpt_oss.h100.gpt_oss import (
66+
gpt_oss_120b_sft_48gpu_h100_bf16_32k_config as gpt_oss_120b_sft_32k_config,
67+
)
6568

6669

6770
__all__ = [
6871
"gpt_oss_120b_peft_config",
6972
"gpt_oss_120b_pretrain_config",
73+
"gpt_oss_120b_sft_32k_config",
7074
"gpt_oss_120b_sft_config",
7175
"gpt_oss_20b_peft_config",
7276
"gpt_oss_20b_peft_fp8_current_scaling_config",

‎src/megatron/bridge/recipes/gpt_oss/h100/__init__.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"gpt_oss_120b_peft_8gpu_h100_bf16_config",
2020
"gpt_oss_120b_pretrain_64gpu_h100_bf16_config",
2121
"gpt_oss_120b_sft_32gpu_h100_bf16_config",
22+
"gpt_oss_120b_sft_48gpu_h100_bf16_32k_config",
2223
"gpt_oss_20b_peft_1gpu_h100_bf16_config",
2324
"gpt_oss_20b_peft_1gpu_h100_fp8cs_config",
2425
"gpt_oss_20b_peft_1gpu_h100_fp8mx_config",

‎src/megatron/bridge/recipes/gpt_oss/h100/gpt_oss.py‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,46 @@ def gpt_oss_120b_sft_32gpu_h100_bf16_config() -> ConfigContainer:
568568
return cfg
569569

570570

571+
def gpt_oss_120b_sft_48gpu_h100_bf16_32k_config() -> ConfigContainer:
572+
"""Return the 32K-context full SFT config for GPT-OSS 120B.
573+
574+
Default parallelism: TP=2, PP=6, CP=4, EP=4
575+
576+
Returns:
577+
ConfigContainer with settings pre-configured for GPT-OSS 120B long-context SFT.
578+
"""
579+
cfg = gpt_oss_120b_sft_32gpu_h100_bf16_config()
580+
581+
seq_length = 32768
582+
cfg.model.seq_length = seq_length
583+
cfg.dataset.seq_length = seq_length
584+
cfg.dataset.offline_packing_specs.packed_sequence_size = seq_length
585+
cfg.dataset.offline_packing_specs.pad_seq_to_mult = 8
586+
587+
cfg.model.tensor_model_parallel_size = 2
588+
cfg.model.sequence_parallel = True
589+
cfg.model.context_parallel_size = 4
590+
cfg.model.pipeline_model_parallel_size = 6
591+
cfg.model.expert_model_parallel_size = 4
592+
cfg.model.cp_comm_type = "a2a"
593+
cfg.model.calculate_per_token_loss = True
594+
595+
cfg.model.cross_entropy_loss_fusion = False
596+
cfg.model.bias_activation_fusion = False
597+
cfg.model.recompute_granularity = "selective"
598+
cfg.model.recompute_modules = ["moe_act"]
599+
600+
cfg.train.global_batch_size = 4
601+
cfg.train.micro_batch_size = 1
602+
cfg.ddp.average_in_collective = False
603+
604+
# Keep the complete process environment visible on the recipe.
605+
cfg.env_vars = {
606+
**COMMON_RECIPE_ENV_VARS,
607+
}
608+
return cfg
609+
610+
571611
def gpt_oss_20b_sft_8gpu_h100_fp8cs_config() -> ConfigContainer:
572612
"""Return a full SFT config for GPT-OSS 20B with Hopper FP8 current scaling."""
573613
cfg = gpt_oss_20b_sft_8gpu_h100_bf16_config()
@@ -946,6 +986,7 @@ def gpt_oss_20b_sft_8gpu_h100_bf16_openmathinstruct2_thinking_packed_config() ->
946986
"gpt_oss_120b_peft_8gpu_h100_bf16_config",
947987
"gpt_oss_120b_pretrain_64gpu_h100_bf16_config",
948988
"gpt_oss_120b_sft_32gpu_h100_bf16_config",
989+
"gpt_oss_120b_sft_48gpu_h100_bf16_32k_config",
949990
"gpt_oss_20b_peft_1gpu_h100_bf16_config",
950991
"gpt_oss_20b_peft_1gpu_h100_fp8cs_config",
951992
"gpt_oss_20b_peft_1gpu_h100_fp8mx_config",

0 commit comments

Comments
 (0)