verl icon indicating copy to clipboard operation
verl copied to clipboard

Qwen 3 30b moe lora training fails after some steps on megatron

Open thesillystudent opened this issue 1 year ago • 9 comments

System Info

system info

----------Python Info----------
Version      : 3.12.0
Compiler     : GCC 11.2.0
Build        : ('main', 'Oct  2 2023 17:29:18')
Arch         : ('64bit', 'ELF')
------------Pip Info-----------
Version      : 25.3
Directory    : /home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/pip                                                                                 [0/1875]
vllm         : 0.11.0
sglang       : not found.
ray          : 2.52.0
torch        : 2.8.0+cu128
----------verl Info-----------
Version      : 0.7.0.dev
Directory    : /mnt/efs/maroahma-work/small-oracle-exps/nov25/verl-fresh/verl/verl
Commit Hash  : d0997d2a0e14ce8a2a9bb19acbe47ab87ca3a498
----------Platform Info----------
Platform     : Linux-6.1.158-178.288.amzn2023.x86_64-x86_64-with-glibc2.34
system       : Linux
node         : ip-172-31-36-96.ec2.internal
release      : 6.1.158-178.288.amzn2023.x86_64
version      : #1 SMP PREEMPT_DYNAMIC Mon Nov  3 18:38:36 UTC 2025
----------Environment----------
CUDA Runtime : 12.8
CUDA Compiler : Cuda compilation tools, release 12.8, V12.8.93
----------System Info----------
CPU Memory      : 1121.80 GB
GPU Count       : 8
GPU 1   Type    : NVIDIA A100-SXM4-80GB
GPU 1   Memory  : 80.00 GB
GPU 2   Type    : NVIDIA A100-SXM4-80GB
GPU 2   Memory  : 80.00 GB
GPU 3   Type    : NVIDIA A100-SXM4-80GB
GPU 3   Memory  : 80.00 GB
GPU 4   Type    : NVIDIA A100-SXM4-80GB
GPU 4   Memory  : 80.00 GB
GPU 5   Type    : NVIDIA A100-SXM4-80GB
GPU 5   Memory  : 80.00 GB
GPU 6   Type    : NVIDIA A100-SXM4-80GB
GPU 6   Memory  : 80.00 GB
GPU 7   Type    : NVIDIA A100-SXM4-80GB
GPU 7   Memory  : 80.00 GB
GPU 8   Type    : NVIDIA A100-SXM4-80GB
GPU 8   Memory  : 80.00 GB

trace

(WorkerDict pid=2019448)
Training Progress:   2%|▏         | 18/870 [1:26:15<64:56:23, 274.39s/it]
(TaskRunner pid=2016251) step:18 - actor/entropy:0.0913529247045517 - actor/kl_loss:0.002341846047784202 - actor/kl_coef:0.001 - actor/pg_clipfrac:0.0005853319671587087 - actor/ppo_kl:-0.00013585589412912213 - actor/pg_clipfrac_lower:0.0 - actor/pg_loss:0.0073384931311011314 - actor/grad_norm:0.04752542037938953 - perf/mfu/actor:0.04156957807299371 - perf/max_memory_allocated_gb:39.634201526641846 - perf/max_memory_reserved_gb:40.791015625 - perf/cpu_memory_used_gb:159.1600570678711 - actor/lr:3e-06 - training/global_step:18 - training/epoch:0 - critic/score/mean:0.966796875 - critic/score/max:1.0 - critic/score/min:0.0 - critic/rewards/mean:0.966796875 - critic/rewards/max:1.0 - critic/rewards/min:0.0 - critic/advantages/mean:-0.007540564984083176 - critic/advantages/max:0.8660238981246948 - critic/advantages/min:-1.4999970197677612 - critic/returns/mean:-0.007540564984083176 - critic/returns/max:0.8660238981246948 - critic/returns/min:-1.4999970197677612 - response_length/mean:240.4140625 - response_length/max:1024.0 - response_length/min:78.0 - response_length/clip_ratio:0.0078125 - response_length_non_aborted/mean:240.4140625 - response_length_non_aborted/max:1024.0 - response_length_non_aborted/min:78.0 - response_length_non_aborted/clip_ratio:0.0078125 - response/aborted_ratio:0.0 - prompt_length/mean:82.3828125 - prompt_length/max:150.0 - prompt_length/min:46.0 - prompt_length/clip_ratio:0.0 - num_turns/min:2 - num_turns/max:2 - num_turns/mean:2.0 - timing_s/start_profile:4.4357002479955554e-05 - timing_s/agent_loop/generate_sequences/min:8.137254288012628 - timing_s/agent_loop/generate_sequences/max:140.6492429759819 - timing_s/agent_loop/generate_sequences/mean:22.176736191921123 - timing_s/agent_loop/tool_calls/min:0.0 - timing_s/agent_loop/tool_calls/max:0.0 - timing_s/agent_loop/tool_calls/mean:0.0 - timing_s/agent_loop/slowest/generate_sequences:140.6492429759819 - timing_s/agent_loop/slowest/tool_calls:0.0 - timing_s/agent_loop/slowest/prompt_length:59 - timing_s/agent_loop/slowest/response_length:1024 - timing_s/gen:165.60969395999564 - timing_s/reward:0.00010643398854881525 - timing_s/old_log_prob:19.332523345015943 - timing_s/ref:28.19714130999637 - timing_s/adv:0.020495050004683435 - timing_s/update_actor:38.66489887100761 - timing_s/step:251.90244642400648 - timing_s/stop_profile:4.052399890497327e-05 - timing_per_token_ms/adv:0.00012400799896342655 - timing_per_token_ms/gen:1.3454139502160631 - timing_per_token_ms/update_actor:0.2339470622428942 - timing_per_token_ms/ref:0.1706105166634177 - perf/total_num_tokens:165272 - perf/time_per_step:251.90244642400648 - perf/throughput:82.01190696348546
(WorkerDict pid=2019445) Converting to HuggingFace ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00 (3411/3411) Qwen3MoEBridge
(WorkerDict pid=2019451)
(WorkerDict pid=2019452)
(WorkerDict pid=2019446)
(WorkerDict pid=2019450)
(WorkerDict pid=2019447)
(WorkerDict pid=2019449)
(WorkerDict pid=2019448)
Training Progress:   2%|▏         | 19/870 [1:30:22<62:54:14, 266.10s/it]
(TaskRunner pid=2016251) step:19 - actor/entropy:0.09676892310380936 - actor/kl_loss:0.003263807069743052 - actor/kl_coef:0.001 - actor/pg_clipfrac:0.0009080496456590481 - actor/ppo_kl:-0.00018109444295077992 - actor/pg_clipfrac_lower:0.0 - actor/pg_loss:0.01952332048676908 - actor/grad_norm:0.050373204039674276 - perf/mfu/actor:0.042605288606521394 - perf/max_memory_allocated_gb:39.73102807998657 - perf/max_memory_reserved_gb:41.048828125 - perf/cpu_memory_used_gb:159.24848175048828 - actor/lr:3e-06 - training/global_step:19 - training/epoch:0 - critic/score/mean:0.880859375 - critic/score/max:1.0 - critic/score/min:0.0 - critic/rewards/mean:0.880859375 - critic/rewards/max:1.0 - critic/rewards/min:0.0 - critic/advantages/mean:-0.019687611609697342 - critic/advantages/max:1.4999970197677612 - critic/advantages/min:-1.4999970197677612 - critic/returns/mean:-0.019687611609697342 - critic/returns/max:1.4999970197677612 - critic/returns/min:-1.4999970197677612 - response_length/mean:235.78125 - response_length/max:1024.0 - response_length/min:79.0 - response_length/clip_ratio:0.015625 - response_length_non_aborted/mean:235.78125 - response_length_non_aborted/max:1024.0 - response_length_non_aborted/min:79.0 - response_length_non_aborted/clip_ratio:0.015625 - response/aborted_ratio:0.0 - prompt_length/mean:81.46875 - prompt_length/max:211.0 - prompt_length/min:35.0 - prompt_length/clip_ratio:0.0 - num_turns/min:2 - num_turns/max:2 - num_turns/mean:2.0 - timing_s/start_profile:6.885000038892031e-05 - timing_s/agent_loop/generate_sequences/min:8.764613565988839 - timing_s/agent_loop/generate_sequences/max:138.41719722998096 - timing_s/agent_loop/generate_sequences/mean:22.25071116261114 - timing_s/agent_loop/tool_calls/min:0.0 - timing_s/agent_loop/tool_calls/max:0.0 - timing_s/agent_loop/tool_calls/mean:0.0 - timing_s/agent_loop/slowest/generate_sequences:138.41719722998096 - timing_s/agent_loop/slowest/tool_calls:0.0 - timing_s/agent_loop/slowest/prompt_length:118 - timing_s/agent_loop/slowest/response_length:1024 - timing_s/gen:159.0266509219946 - timing_s/reward:0.00010023600771091878 - timing_s/old_log_prob:19.478314672975102 - timing_s/ref:30.71588948200224 - timing_s/adv:0.02074367698514834 - timing_s/update_actor:37.446701558015775 - timing_s/step:246.76672840601532 - timing_s/stop_profile:6.104400381445885e-05 - timing_per_token_ms/adv:0.00012770683723126194 - timing_per_token_ms/gen:1.3173181819250712 - timing_per_token_ms/update_actor:0.23053771152245725 - timing_per_token_ms/ref:0.18909998942328013 - perf/total_num_tokens:162432 - perf/time_per_step:246.76672840601532 - perf/throughput:82.2801361072997
(WorkerDict pid=2019445) Converting to HuggingFace ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00 (3411/3411) Qwen3MoEBridge
(WorkerDict pid=2019451)
(WorkerDict pid=2019452)
(WorkerDict pid=2019446)
(WorkerDict pid=2019450)
(WorkerDict pid=2019447)
(WorkerDict pid=2019449)
(WorkerDict pid=2019448)
(TaskRunner pid=2016251) test_gen_batch meta info: {'eos_token_id': 151645, 'pad_token_id': 151643, 'recompute_log_prob': False, 'do_sample': False, 'validate': True, 'global_steps': 20}
(WorkerDict pid=2019445) Converting to HuggingFace ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00 (3411/3411) Qwen3MoEBridge
(WorkerDict pid=2019451)
(WorkerDict pid=2019452)
(WorkerDict pid=2019446)
(WorkerDict pid=2019450)
(WorkerDict pid=2019447)
(WorkerDict pid=2019449)
(WorkerDict pid=2019448)
(TaskRunner pid=2016251) validation generation end
(TaskRunner pid=2016251) local_global_step_folder: checkpoints/verl_grpo_example_gsm8k_math/qwen3_30b_a3b_megatron_lora/global_step_20
(WorkerDict pid=2019445) WARNING:2025-11-26 10:56:29,855:ShardedTensor.flattened_range is deprecated. Use latest DistributedOptimizer formats.
Error executing job with overrides: ['data.train_files=/home/ec2-user/data/gsm8k/train.parquet', 'data.val_files=/home/ec2-user/data/gsm8k/test.parquet', 'data.train_batch_size=128', 'data.max_prompt_length=1024', 'data.max_response_length=1024', 'data.truncation=error', 'data.filter_overlong_prompts=True', 'data.shuffle=False', 'algorithm.adv_estimator=grpo', 'actor_rollout_ref.model.path=Qwen/Qwen3-30B-A3B-Instruct-2507', 'actor_rollout_ref.model.lora.rank=16', 'actor_rollout_ref.model.lora.alpha=32', 'actor_rollout_ref.model.use_fused_kernels=True', 'actor_rollout_ref.rollout.tensor_model_parallel_size=8', 'actor_rollout_ref.rollout.log_prob_micro_batch_size_per_gpu=4', 'actor_rollout_ref.rollout.log_prob_use_dynamic_bsz=True', 'actor_rollout_ref.rollout.name=vllm', 'actor_rollout_ref.rollout.gpu_memory_utilization=0.25', 'actor_rollout_ref.rollout.enforce_eager=True', 'actor_rollout_ref.rollout.free_cache_engine=True', 'actor_rollout_ref.rollout.n=4', 'actor_rollout_ref.actor.optim.lr=3e-6', 'actor_rollout_ref.actor.ppo_mini_batch_size=16', 'actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=2', 'actor_rollout_ref.actor.megatron.use_mbridge=True', 'actor_rollout_ref.actor.megatron.vanilla_mbridge=False', 'actor_rollout_ref.actor.use_dynamic_bsz=True', 'actor_rollout_ref.actor.use_kl_loss=True', 'actor_rollout_ref.actor.kl_loss_coef=0.001', 'actor_rollout_ref.actor.kl_loss_type=low_var_kl', 'actor_rollout_ref.actor.entropy_coeff=0', 'actor_rollout_ref.actor.megatron.tensor_model_parallel_size=2', 'actor_rollout_ref.actor.megatron.pipeline_model_parallel_size=2', 'actor_rollout_ref.actor.megatron.expert_model_parallel_size=4', 'actor_rollout_ref.actor.megatron.context_parallel_size=2', 'actor_rollout_ref.actor.megatron.expert_tensor_parallel_size=1', 'actor_rollout_ref.actor.megatron.param_offload=True', 'actor_rollout_ref.actor.megatron.optimizer_offload=True', 'actor_rollout_ref.actor.megatron.grad_offload=True', '+actor_rollout_ref.actor.megatron.override_transformer_config.recompute_method=uniform', '+actor_rollout_ref.actor.megatron.override_transformer_config.recompute_granularity=full', '+actor_rollout_ref.actor.megatron.override_transformer_config.recompute_num_layers=1', 'actor_rollout_ref.ref.log_prob_micro_batch_size_per_gpu=4', 'actor_rollout_ref.ref.log_prob_use_dynamic_bsz=True', 'actor_rollout_ref.ref.megatron.tensor_model_parallel_size=2', 'actor_rollout_ref.ref.megatron.pipeline_model_parallel_size=2', 'actor_rollout_ref.ref.megatron.expert_model_parallel_size=4', 'actor_rollout_ref.ref.megatron.context_parallel_size=2', 'actor_rollout_ref.ref.megatron.expert_tensor_parallel_size=1', 'actor_rollout_ref.ref.megatron.param_offload=True', 'trainer.critic_warmup=0', 'trainer.logger=["console"]', 'trainer.project_name=verl_grpo_example_gsm8k_math', 'trainer.experiment_name=qwen3_30b_a3b_megatron_lora', 'trainer.n_gpus_per_node=8', 'trainer.nnodes=1', 'trainer.save_freq=20', 'trainer.test_freq=5', 'trainer.total_epochs=15']
Traceback (most recent call last):
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/verl/trainer/main_ppo.py", line 43, in main
    run_ppo(config)
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/verl/trainer/main_ppo.py", line 97, in run_ppo
    ray.get(runner.run.remote(config))
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/ray/_private/auto_init_hook.py", line 22, in auto_init_wrapper
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/ray/_private/client_mode_hook.py", line 104, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/ray/_private/worker.py", line 2972, in get
    values, debugger_breakpoint = worker.get_objects(
                                  ^^^^^^^^^^^^^^^^^^^
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/ray/_private/worker.py", line 1031, in get_objects
    raise value.as_instanceof_cause()
ray.exceptions.RayTaskError(CheckpointingException): ray::TaskRunner.run() (pid=2016251, ip=172.31.36.96, actor_id=1e919bf0bab63164bedf675501000000, repr=<main_ppo.TaskRunner object at 0x7f5282188470>)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/verl/trainer/main_ppo.py", line 366, in run
    trainer.fit()
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/verl/trainer/ppo/ray_trainer.py", line 1272, in fit
    self._save_checkpoint()
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/verl/trainer/ppo/ray_trainer.py", line 822, in _save_checkpoint
    self.actor_rollout_wg.save_checkpoint(
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/verl/single_controller/ray/base.py", line 49, in __call__
    output = ray.get(output)
             ^^^^^^^^^^^^^^^
           ^^^^^^^^^^^^^^^^^^^
           ^^^^^^^^^^^^^^^^^^^^^
                                  ^^^^^^^^^^^^^^^^^^^

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/verl/single_controller/ray/base.py", line 825, in func
    return getattr(self.worker_dict[key], name)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                    [0/1948]
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/verl/single_controller/base/decorator.py", line 451, in inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/verl/utils/transferqueue_utils.py", line 185, in dummy_inner
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/verl/workers/megatron_workers.py", line 877, in save_checkpoint
    self.checkpoint_mananager.save_checkpoint(
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/verl/utils/checkpoint/megatron_checkpoint_manager.py", line 466, in save_checkpoint
    async_save_request = save_dist_checkpointing(
                         ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/verl/utils/megatron/dist_checkpointing.py", line 36, in save_dist_checkpointing
    async_save_request = dist_checkpointing.save(
                         ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/megatron/core/dist_checkpointing/serialization.py", line 403, in save
    sharded_state_dict, state_dict = save_preprocess(
                                     ^^^^^^^^^^^^^^^^
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/megatron/core/dist_checkpointing/state_dict_utils.py", line 50, in save_preprocess
    validate_sharding_integrity(
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/megatron/core/dist_checkpointing/validation.py", line 444, in validate_sharding_integrity
    _validate_sharding_for_key(shardings)
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/megatron/core/dist_checkpointing/validation.py", line 483, in _validate_sharding_for_key
    map_reduce(
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/megatron/core/dist_checkpointing/dict_utils.py", line 255, in map_reduce
    res[k] = reduce_fn(res[k])
             ^^^^^^^^^^^^^^^^^
  File "/home/ec2-user/miniconda3/envs/verl/lib/python3.12/site-packages/megatron/core/dist_checkpointing/validation.py", line 524, in _validate_sharding_for_key_flattened
    raise CheckpointingException(
megatron.core.dist_checkpointing.core.CheckpointingException: Flattened ranges dont cover the whole shard ShardedTensor(key='chained_1.optimizer.state.exp_avg.decoder.layer
s.mlp.experts.experts.linear_fc2.adapter.linear_out.weight', dtype=torch.float32, local_shape=(2048, 16), global_shape=(48, 2048, 16), global_offset=(23, 0, 0), axis_fragme
ntations=(48, 1, 1), replica_id=(0, 0, 0), prepend_axis_num=1, allow_shape_mismatch=False, flattened_range=slice(0, 32768, None)) of size 32768. Ranges: (array([0, 0, 0, 0]
), array([32768, 32768, 32768, 32768]))

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

Information

  • [x] The official example scripts
  • [ ] My own modified scripts

Tasks

  • [x] An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • [ ] My own task or dataset (give details below)

Reproduction

bash examples/grpo_trainer/run_qwen3moe-30b_megatron_lora.sh

Expected behavior

training should not fail

thesillystudent avatar Nov 26 '25 11:11 thesillystudent

same issue, failed to save due to megatron.core.dist_checkpointing.core.CheckpointingException: Flattened ranges dont cover the whole shard ShardedTensor

Junxiao-Zhao avatar Nov 29 '25 02:11 Junxiao-Zhao

it looks like something wrong with saving the optimizer states, @HollowMan6 did you meet this before? +@yaoyu-33 for viz

ISEEKYAN avatar Nov 29 '25 02:11 ISEEKYAN

For now my tests on megatron LoRA are still on the convergence issue of dense model side and I didn't really use checkpoints, but those should have already been covered by CI (saving checkpoints after 1 step for either dense or moe).

Can this be related to "ShardedTensor.flattened_range is deprecated. Use latest DistributedOptimizer formats"? Make sure you are using this commit for mcore: https://github.com/NVIDIA/Megatron-LM/tree/3cbe5c68a40c5820c11fc60fea1143dc6983706e

If you are already using it and the saving checkpoints only fails after some steps (the first checkpoint saving is fine), then I highly doubt that this can be related to the LoRA convergence issue on the Megatron-Bridge side, as I have already double checked with other people related to the converged LoRA config on other frameworks that also use megatron, and I still can't get it converged. Did you manage to get the training converged @thesillystudent @Junxiao-Zhao?

HollowMan6 avatar Nov 29 '25 10:11 HollowMan6

Hi @HollowMan6, thanks for your reply! I'll test it again using the commit you mentioned.

Junxiao-Zhao avatar Nov 29 '25 11:11 Junxiao-Zhao

Update

Unfortunately, switch mcore to the specific commint neither fix the warning nor solve the exception. But I've came up with a temporary fix that could bypass the validation.

Add a monkey patch at the top of verl/utils/megatron/dist_checkpointing.py, and set validate_sharding_integrity in both save and load functions to False.

--- a/verl/utils/megatron/dist_checkpointing.py
+++ b/verl/utils/megatron/dist_checkpointing.py
@@ -23,9 +23,25 @@ from megatron.core.dist_checkpointing.strategies.fully_parallel import (
     FullyParallelSaveStrategyWrapper,
 )
 
+# ================= [START FIX] =================
+try:
+    import megatron.core.dist_checkpointing.strategies.fully_parallel as megatron_fully_parallel
+    import megatron.core.dist_checkpointing.validation as megatron_validation
+
+    def skip_validation(*args, **kwargs):
+        return
+
+    megatron_validation.validate_sharding_integrity = skip_validation
+    megatron_fully_parallel.validate_sharding_integrity = skip_validation
+
+    print(">>> Successfully monkey-patched validate_sharding_integrity to skip checks.")
+except Exception as e:
+    print(f">>> Warning: Failed to patch validation logic: {e}")
+# ================= [END FIX] =================
+
 
 def save_dist_checkpointing(sharded_state_dict, ckpt_path, async_save=False):
-    validate_sharding_integrity = True
+    validate_sharding_integrity = False
     # Get checkpointing strategies
     save_strategy = get_default_save_sharded_strategy("torch_dist")
     save_strategy = FullyParallelSaveStrategyWrapper(
@@ -45,6 +61,7 @@ def save_dist_checkpointing(sharded_state_dict, ckpt_path, async_save=False):
 
 
 def load_dist_checkpointing(sharded_state_dict, ckpt_dir):
+    validate_sharding_integrity = False
     # Get checkpointing strategies
     load_strategy = get_default_load_sharded_strategy(ckpt_dir)
     load_strategy = FullyParallelLoadStrategyWrapper(
@@ -61,6 +78,11 @@ def load_dist_checkpointing(sharded_state_dict, ckpt_dir):
         pass
 
     # Load model sharded state dicts
-    state_dict = dist_checkpointing.load(sharded_state_dict, ckpt_dir, sharded_strategy=load_strategy)
+    state_dict = dist_checkpointing.load(
+        sharded_state_dict,
+        ckpt_dir,
+        sharded_strategy=load_strategy,
+        validate_access_integrity=validate_sharding_integrity,
+    )
 
     return state_dict

I've tested that this could save and resume successfully.

Junxiao-Zhao avatar Dec 01 '25 12:12 Junxiao-Zhao

Hi @Junxiao-Zhao @thesillystudent ! I just opened a PR on the Megatron-Bridge side https://github.com/NVIDIA-NeMo/Megatron-Bridge/pull/1564 which I believe can also fix this issue (tested locally and works fine for various parallel configuration settings under 8 GPUs for bash examples/grpo_trainer/run_qwen3moe-30b_megatron_lora.sh), please let me know if you find anything still not right here. cc: @ISEEKYAN @yaoyu-33

HollowMan6 avatar Dec 02 '25 23:12 HollowMan6

Many thanks to @HollowMan6 for your great job!

ISEEKYAN avatar Dec 05 '25 14:12 ISEEKYAN

@HollowMan6 still fail when training qwen 3 vl moe https://github.com/volcengine/verl/issues/4990

Hayak3 avatar Jan 20 '26 04:01 Hayak3

@HollowMan6 still fail when training qwen 3 vl moe #4990

I haven't tested Qwen3 VL MoE for a while, but if you are using verl/examples/grpo_trainer/run_qwen3_vl-30b-megatron.sh, then you are using mbridge instead of Megatron-Bridge right? And you are not using LoRA right? Then your issue should be a separate one.

HollowMan6 avatar Jan 20 '26 08:01 HollowMan6