Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# Copyright (c) 2026, 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.

# Validated 9-node/72-GPU packed MedPix run for GLM-5.3-Flash. CP2 gives DP36;
# EP72 spans the dp(36) x cp(2) mesh and stores four of 288 routed experts per
# GPU. Four accumulation microsteps form each 144-pack optimizer step. TP and PP
# remain disabled.

recipe: FinetuneRecipeForVLM
seed: 1234

step_scheduler:
global_batch_size: 144
local_batch_size: 1
ckpt_every_steps: 1000
val_every_steps: 1000
log_remote_every_steps: 1
gc_every_steps: 5
num_epochs: 4
max_steps: 100

dist_env:
backend: nccl
timeout_minutes: 120

rng:
_target_: nemo_automodel.components.training.rng.StatefulRNG
seed: 1234
ranked: true
deterministic: true

model:
_target_: nemo_automodel.NeMoAutoModelForImageTextToText.from_pretrained
pretrained_model_name_or_path: zai-org/GLM-5.3-Flash
torch_dtype: bfloat16
attn_implementation: sdpa
use_liger_kernel: false
use_sdpa_patching: false
text_config:
output_hidden_states: true
num_nextn_predict_layers: 0
backend:
_target_: nemo_automodel.components.models.common.BackendConfig
# KDA layers remain on FLA; this selects cuDNN/FlashMLA for sparse MLA layers.
attn: cudnn
linear: torch
rms_norm: torch_fp32
experts: torch_mm
dispatcher: hybridep
rope_fusion: false
gate_precision: float32
fake_balanced_gate: false
enable_hf_state_dict_adapter: true
enable_fsdp_optimizations: true

processor:
_target_: nemo_automodel.components.models.glm5_next.processing.build_glm5_next_processor
pretrained_model_name_or_path: zai-org/GLM-5.3-Flash
trust_remote_code: false

checkpoint:
enabled: false
checkpoint_dir: checkpoints/glm5_3_flash_medpix_packed2k_ep72_cp2_100steps/
model_save_format: safetensors
save_consolidated: false
dequantize_base_checkpoint: true

distributed:
strategy: fsdp2
tp_size: 1
cp_size: 2
pp_size: 1
ep_size: 72
sequence_parallel: false
activation_checkpointing: true
# Avoid retaining a full accumulated gradient set across four microsteps.
defer_fsdp_grad_sync: false
moe:
reshard_after_forward: false
wrap_outer_model: true
ignore_router_for_ac: true

freeze_config:
freeze_embeddings: true
freeze_vision_tower: true
freeze_audio_tower: true
freeze_language_model: false

loss_fn:
_target_: nemo_automodel.components.loss.linear_ce.FusedLinearCrossEntropy

dataset:
_target_: nemo_automodel.components.datasets.vlm.datasets.make_medpix_dataset
path_or_dataset: mmoukouba/MedPix-VQA
split: train

packed_sequence:
pretokenize: true
max_length: 2048
pack_size: 2048
collate_max_length: 2048
packing_ratio: 0.9
drop_long_samples: true
balance_media_tokens: true
packing_format: neat
attn_implementation: sdpa

dataloader:
_target_: torchdata.stateful_dataloader.StatefulDataLoader
num_workers: 1
persistent_workers: true
pin_memory: true
drop_last: true

validation_dataset: none
validation_dataloader: none

optimizer:
_target_: torch.optim.AdamW
betas: [0.9, 0.95]
eps: 1e-8
lr: 5.0e-6
weight_decay: 0.1

lr_scheduler:
lr_decay_style: constant

clip_grad_norm:
max_norm: 1.0

wandb:
enable: false
project: huiyingl_workspace
entity: Nemo-automodel
name: glm5_3_flash_medpix_packed2k_ep72_cp2_100steps
group: glm5_3_flash_medpix_packed2k_cp_parity_100steps
tags: [glm5.3-flash, medpix, vlm, packed2k, ep72, cp2, parity]
dir: logs/glm5_3_flash_medpix_packed2k_ep72_cp2_100steps/wandb

ci:
recipe_owner: HuiyingLi
nodes: 9
time: "01:00:00"
max_steps: 5
8 changes: 8 additions & 0 deletions nemo_automodel/_transformers/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@
"GlmMoeDsaForCausalLM",
("nemo_automodel.components.models.glm_moe_dsa.model", "GlmMoeDsaForCausalLM"),
),
(
"Glm5NextForConditionalGeneration",
(
"nemo_automodel.components.models.glm5_next.model",
"Glm5NextForConditionalGeneration",
),
),
(
"Gemma4ForConditionalGeneration",
("nemo_automodel.components.models.gemma4_moe.model", "Gemma4ForConditionalGeneration"),
Expand Down Expand Up @@ -326,6 +333,7 @@
"bailing_moe": ("nemo_automodel.components.models.ling_v2.config", "BailingMoeV2Config"),
"deepseek_v4": ("nemo_automodel.components.models.deepseek_v4.config", "DeepseekV4Config"),
"glm_moe_dsa": ("nemo_automodel.components.models.glm_moe_dsa.config", "GlmMoeDsaConfig"),
"glm5_next": ("nemo_automodel.components.models.glm5_next.config", "Glm5NextConfig"),
"hy_v3": ("nemo_automodel.components.models.hy_v3.config", "HYV3Config"),
"inkling_mm_model": ("nemo_automodel.components.models.inkling.configuration", "InklingConfig"),
"kimi_k2": ("nemo_automodel.components.models.kimi_k2.config", "KimiK2Config"),
Expand Down
Loading
Loading