Checklist / 检查清单
- [x] I have searched existing issues, and this is a new bug report. / 我已经搜索过现有的 issues,确认这是一个新的 bug report。
Bug Description / Bug 描述
进行GKD(on-policy distillation)训练(student rollout+student training+teacher vllm server)时,发现偶尔会报错cuda illegal(无法稳定复现),想请问这个可能是什么原因?
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: Traceback (most recent call last):
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/yangpenghui1/ms-swift/swift/cli/rlhf.py", line 7, in
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: rlhf_main()
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/yangpenghui1/ms-swift/swift/pipelines/train/rlhf.py", line 246, in rlhf_main
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: return SwiftRLHF(args).main()
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/yangpenghui1/ms-swift/swift/pipelines/base.py", line 52, in main
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: result = self.run()
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/yangpenghui1/ms-swift/swift/ray/base.py", line 168, in wrapper
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: return func(self, *args, **kwargs)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/yangpenghui1/ms-swift/swift/pipelines/train/sft.py", line 197, in run
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: return self.train(trainer)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/yangpenghui1/ms-swift/swift/pipelines/train/sft.py", line 271, in train
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: trainer.train(resume_checkpoint)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/yangpenghui1/ms-swift/swift/trainers/mixin.py", line 903, in train
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: res = super().train(*args, **kwargs)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/transformers/trainer.py", line 1424, in train
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: return inner_training_loop(
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/transformers/trainer.py", line 1506, in _inner_training_loop
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: self._run_epoch(
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/transformers/trainer.py", line 1734, in _run_epoch
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: tr_loss_step = self.training_step(model, inputs, num_items_in_batch)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/yangpenghui1/ms-swift/swift/rlhf_trainers/utils.py", line 613, in wrapper
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: return func(self, *args, **kwargs)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/yangpenghui1/ms-swift/swift/rlhf_trainers/gkd_trainer.py", line 1092, in training_step
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: return HFSFTTrainer.training_step(self, model, inputs, num_items_in_batch)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/trl/trainer/sft_trainer.py", line 1338, in training_step
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: return super().training_step(*args, **kwargs)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/transformers/trainer.py", line 1934, in training_step
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: self.accelerator.backward(loss, **kwargs)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/accelerate/accelerator.py", line 2830, in backward
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: self.deepspeed_engine_wrapped.backward(loss, sync_gradients=self.sync_gradients, **kwargs)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/accelerate/utils/deepspeed.py", line 270, in backward
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: self.engine.backward(loss, **kwargs)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/deepspeed/utils/nvtx.py", line 33, in wrapped_fn
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ret_val = func(*args, **kwargs)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/deepspeed/runtime/engine.py", line 2633, in backward
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: loss.backward(**backward_kwargs)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/_tensor.py", line 630, in backward
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: torch.autograd.backward(
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/autograd/init.py", line 364, in backward
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: _engine_run_backward(
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/autograd/graph.py", line 865, in _engine_run_backward
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: return Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/autograd/function.py", line 317, in apply
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: return user_fn(self, *args)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/utils/checkpoint.py", line 325, in backward
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: torch.autograd.backward(outputs_with_grad, args_with_grad)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/autograd/init.py", line 364, in backward
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: _engine_run_backward(
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/autograd/graph.py", line 865, in _engine_run_backward
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: return Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/autograd/function.py", line 317, in apply
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: return user_fn(self, *args)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/deepspeed/runtime/zero/parameter_offload.py", line 419, in backward
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ctx.pre_backward_function(ctx.module)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/deepspeed/utils/nvtx.py", line 33, in wrapped_fn
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ret_val = func(*args, **kwargs)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/deepspeed/runtime/zero/parameter_offload.py", line 400, in _run_before_backward_function
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: self.pre_sub_module_backward_function(sub_module)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 124, in decorate_context
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: return func(*args, **kwargs)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/deepspeed/runtime/zero/parameter_offload.py", line 509, in pre_sub_module_backward_function
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: param_coordinator.fetch_sub_module(sub_module, forward=False)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/_dynamo/eval_frame.py", line 1181, in _fn
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: return fn(*args, **kwargs)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/deepspeed/utils/nvtx.py", line 33, in wrapped_fn
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ret_val = func(*args, **kwargs)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 124, in decorate_context
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: return func(*args, **kwargs)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/deepspeed/runtime/zero/partitioned_param_coordinator.py", line 325, in fetch_sub_module
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: self._fetch_sub_module_impl(current_submodule, forward, is_leaf)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/deepspeed/runtime/zero/partitioned_param_coordinator.py", line 460, in _fetch_sub_module_impl
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: self.__all_gather_params(params_to_prefetch, forward)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/deepspeed/utils/nvtx.py", line 33, in wrapped_fn
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ret_val = func(*args, **kwargs)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/deepspeed/runtime/zero/partitioned_param_coordinator.py", line 520, in __all_gather_params
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: self._all_gather_params(nonquantized_params, forward, quantize=self.zero_quantized_weights)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/deepspeed/runtime/zero/partitioned_param_coordinator.py", line 549, in _all_gather_params
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: handle = param_group[0].all_gather_coalesced(param_group, quantize=quantize)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/deepspeed/utils/nvtx.py", line 33, in wrapped_fn
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ret_val = func(*args, **kwargs)
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/deepspeed/runtime/zero/partition_parameters.py", line 1491, in all_gather_coalesced
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: return _all_gather_coalesced(params, world_size, rank_in_group, use_secondary_tensor, ds_process_group,
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/deepspeed/runtime/zero/partition_parameters.py", line 1377, in _all_gather_coalesced
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: _all_gather_dtype(dtype_params[dtype], world_size, rank_in_group, ds_process_group, dtype))
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: File "/mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/deepspeed/runtime/zero/partition_parameters.py", line 1262, in _all_gather_dtype
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: [p.ds_tensor.to(get_accelerator().current_device_name()).to(allgather_dtype) for p in params],
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: torch.AcceleratorError: CUDA error: an illegal memory access was encountered
[2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: Search for cudaErrorIllegalAddress' in https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html for more information. [2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect. [2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: For debugging consider passing CUDA_LAUNCH_BLOCKING=1 [2026-06-21T01:26:03+08:00] simulate-qwen36-gpt-train-22558506-8beb9-cfcd2 >> [rank3]: Compile with TORCH_USE_CUDA_DSA` to enable device-side assertions.
How to Reproduce / 如何复现
ms-swift: 4.3.0
cuda: 12.8
GPU: H200
Additional Information / 补充信息
codex分析可能问题出在teacher侧,例如返回的top-K的index越界之类的
感觉是oom了,尝试加参数 --move_model_batches 10
我加上了这个参数 重启训练还是显示cuda illegal,但是具体日志不太一样,不清楚是否和异步有关
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> [rank3]:[E621 17:32:43.368577663 ProcessGroupNCCL.cpp:2093] [PG ID 0 PG GUID 0(default_pg) Rank 3] Process group watchdog thread terminated with exception: CUDA error: an illegal memory access was encountered
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> Search for cudaErrorIllegalAddress' in https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html for more information. [2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect. [2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> For debugging consider passing CUDA_LAUNCH_BLOCKING=1 [2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> Compile with TORCH_USE_CUDA_DSAto enable device-side assertions. [2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> [2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> Exception raised from query at /pytorch/aten/src/ATen/cuda/CUDAEvent.h:108 (most recent call first): [2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) + 0x9d (0x7f8c6daddfdd in /mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/lib/libc10.so) [2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #1: <unknown function> + 0xc0e0 (0x7f8c6db770e0 in /mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/lib/libc10_cuda.so) [2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #2: c10d::ProcessGroupNCCL::WorkNCCL::finishedGPUExecutionInternal() const + 0x50 (0x7f8b51c5a8c0 in /mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/lib/libtorch_cuda.so) [2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #3: c10d::ProcessGroupNCCL::WorkNCCL::isCompleted() + 0x68 (0x7f8b51c67a38 in /mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/lib/libtorch_cuda.so) [2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #4: c10d::ProcessGroupNCCL::Watchdog::runLoop() + 0x949 (0x7f8b51c6b509 in /mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/lib/libtorch_cuda.so) [2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #5: c10d::ProcessGroupNCCL::Watchdog::run() + 0x105 (0x7f8b51c6d5a5 in /mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/lib/libtorch_cuda.so) [2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #6: <unknown function> + 0xdf0e6 (0x7f8c7294c0e6 in /mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/bin/../lib/libstdc++.so.6) [2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #7: <unknown function> + 0x94ac3 (0x7f8c75786ac3 in /lib/x86_64-linux-gnu/libc.so.6) [2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #8: <unknown function> + 0x126850 (0x7f8c75818850 in /lib/x86_64-linux-gnu/libc.so.6) [2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> [2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> terminate called after throwing an instance of 'c10::DistBackendError' [2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> what(): [PG ID 0 PG GUID 0(default_pg) Rank 3] Process group watchdog thread terminated with exception: CUDA error: an illegal memory access was encountered [2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> Search forcudaErrorIllegalAddress' in https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html for more information.
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> For debugging consider passing CUDA_LAUNCH_BLOCKING=1
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> Compile with TORCH_USE_CUDA_DSA to enable device-side assertions.
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >>
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> Exception raised from query at /pytorch/aten/src/ATen/cuda/CUDAEvent.h:108 (most recent call first):
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits, std::allocator >) + 0x9d (0x7f8c6daddfdd in /mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/lib/libc10.so)
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #1: + 0xc0e0 (0x7f8c6db770e0 in /mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/lib/libc10_cuda.so)
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #2: c10d::ProcessGroupNCCL::WorkNCCL::finishedGPUExecutionInternal() const + 0x50 (0x7f8b51c5a8c0 in /mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/lib/libtorch_cuda.so)
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #3: c10d::ProcessGroupNCCL::WorkNCCL::isCompleted() + 0x68 (0x7f8b51c67a38 in /mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/lib/libtorch_cuda.so)
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #4: c10d::ProcessGroupNCCL::Watchdog::runLoop() + 0x949 (0x7f8b51c6b509 in /mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/lib/libtorch_cuda.so)
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #5: c10d::ProcessGroupNCCL::Watchdog::run() + 0x105 (0x7f8b51c6d5a5 in /mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/lib/libtorch_cuda.so)
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #6: + 0xdf0e6 (0x7f8c7294c0e6 in /mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/bin/../lib/libstdc++.so.6)
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #7: + 0x94ac3 (0x7f8c75786ac3 in /lib/x86_64-linux-gnu/libc.so.6)
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #8: + 0x126850 (0x7f8c75818850 in /lib/x86_64-linux-gnu/libc.so.6)
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >>
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> Exception raised from run at /pytorch/torch/csrc/distributed/c10d/ProcessGroupNCCL.cpp:2099 (most recent call first):
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits, std::allocator >) + 0x9d (0x7f8c6daddfdd in /mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/lib/libc10.so)
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #1: + 0x9bbbc8 (0x7f8b514d3bc8 in /mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/lib/python3.12/site-packages/torch/lib/libtorch_cuda.so)
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #2: + 0xdf0e6 (0x7f8c7294c0e6 in /mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/bin/../lib/libstdc++.so.6)
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #3: + 0x94ac3 (0x7f8c75786ac3 in /lib/x86_64-linux-gnu/libc.so.6)
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> frame #4: + 0x126850 (0x7f8c75818850 in /lib/x86_64-linux-gnu/libc.so.6)
[2026-06-21T17:32:43+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >>
[2026-06-21T17:32:45+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> W0621 17:32:45.839000 961 site-packages/torch/distributed/elastic/multiprocessing/api.py:1010] Sending process 964 closing signal SIGTERM
[2026-06-21T17:32:45+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> W0621 17:32:45.843000 961 site-packages/torch/distributed/elastic/multiprocessing/api.py:1010] Sending process 965 closing signal SIGTERM
[2026-06-21T17:32:45+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> W0621 17:32:45.844000 961 site-packages/torch/distributed/elastic/multiprocessing/api.py:1010] Sending process 966 closing signal SIGTERM
[2026-06-21T17:32:45+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> W0621 17:32:45.845000 961 site-packages/torch/distributed/elastic/multiprocessing/api.py:1010] Sending process 968 closing signal SIGTERM
[2026-06-21T17:32:45+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> W0621 17:32:45.846000 961 site-packages/torch/distributed/elastic/multiprocessing/api.py:1010] Sending process 969 closing signal SIGTERM
[2026-06-21T17:32:45+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> W0621 17:32:45.846000 961 site-packages/torch/distributed/elastic/multiprocessing/api.py:1010] Sending process 970 closing signal SIGTERM
[2026-06-21T17:32:45+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> W0621 17:32:45.847000 961 site-packages/torch/distributed/elastic/multiprocessing/api.py:1010] Sending process 971 closing signal SIGTERM
[2026-06-21T17:33:15+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> W0621 17:33:15.848000 961 site-packages/torch/distributed/elastic/multiprocessing/api.py:1029] Unable to shutdown process 965 via 15, forcefully exiting via 9
[2026-06-21T17:33:27+08:00] simulate-opd-train-qwen36-gpt-40667100-f07ba-cfcd2 >> E0621 17:33:27.522000 961 site-packages/torch/distributed/elastic/multiprocessing/api.py:984] failed (exitcode: -6) local_rank: 3 (pid: 967) of binary: /mnt/shared-storage-user/mllm/yangpenghui/miniconda3/envs/clawrl_swift/bin/python3.12
我的场景下需要student和外部LLM交互生成完整轨迹(multi_turn_scheduler),因此对GKD代码做了一定修改,主要脚本:
1. teacher vllm server
# teacher用的Nex-N2-Pro(based on Qwen3.5-397B)
TEACHER_PATH="nex-agi--Nex-N2-Pro"
vllm serve "$TEACHER_PATH" \
--port "$TEACHER_PORT" \
--tensor-parallel-size 8 \
--gpu-memory-utilization 0.75 \
--max-model-len 64000 \
--language-model-only \
--reasoning-parser qwen3 \
--enable-prefix-caching \
--enable-expert-parallel \
--max-logprobs 64 \
--max_turns 10 \
2. student rollout server
STUDENT_PATH="Qwen3.6-35B-A3B"
swift rollout \
--model "$STUDENT_PATH" \
--host 0.0.0.0 \
--port "$STUDENT_PORT" \
--agent_template qwen3_5 \
--torch_dtype bfloat16 \
--vllm_tensor_parallel_size 1 \
--vllm_enable_expert_parallel true \
--vllm_data_parallel_size 8 \
--vllm_gpu_memory_utilization 0.8 \
--max_logprobs 64 \
3. student train
swift rlhf \
--rlhf_type opd \
--model "$STUDENT_PATH" \
--tuner_type full \
--dataset "$DATASET" \
--agent_template qwen3_5 \
--dataloader_num_workers 8 \
--dataset_num_proc 8 \
--lmbda 1.0 \
--beta 0.0 \
--loss_scale default \
--teacher_model_server "http://$TEACHER_IP:$TEACHER_PORT" \
--gkd_logits_topk "$TEACHER_TOPK" \
--use_vllm true \
--vllm_mode server \
--vllm_server_host "${STUDENT_ROLLOUT_HOSTS[@]}" \
--vllm_server_port "${STUDENT_ROLLOUT_PORTS[@]}" \
--max_turns 10 \
--torch_dtype bfloat16 \
--per_device_train_batch_size 1 \
--gradient_accumulation_steps 8 \
--learning_rate "$LEARNING_RATE" \
--warmup_ratio 0.03 \
--move_model_batches 10 \
--max_length 40000 \
--max_completion_length 16384 \
--deepspeed zero3_offload \
--attn_impl flash_attn \
--save_steps "$SAVE_STEPS" \
--save_total_limit "$SAVE_TOTAL_LIMIT" \
--save_only_model true \
--logging_steps 1 \
--output_dir "$OUTPUT_DIR" \
--log_completions true \
--num_train_epochs "$NUM_TRAIN_EPOCHS"
现在还不清楚是否是Qwen3.6的问题(同样的数据集之前在Qwen3.5-35B-A3B训练没有出现这个报错)。求助大佬如何解决?