Skip to content

AttributeError when linear_decoupled_in_proj is enabled #110

Description

@tomzw11

Checklist / 检查清单

  • I have searched existing issues, and this is a new bug report. / 我已经搜索过现有的 issues,确认这是一个新的 bug report。

Bug Description / Bug 描述

问题描述

linear_decoupled_in_proj 模式下,新创建的线性层(in_proj_qkvzin_proj_ba)是在 super().__init__ 之后才创建的,没有被 DDP 正确处理,导致 main_grad 属性缺失。

gradient_accumulation_fusion 启用时,反向传播会访问 weight.main_grad.dtype,但由于 main_gradNone,会出现:

AttributeError: 'NoneType' object has no attribute 'dtype'

在 1.4 版本和 Qwen3.5 适配中,gradient_accumulation_fusion 是默认启用的(通过 --no-gradient-accumulation-fusion 可以禁用)。

临时解决通过配置 --no-gradient-accumulation-fusion 来避免这个问题。

How to Reproduce / 如何复现

mindspeed 0.16
megatron-core 0.16
mcore-bridge 1.4
ms-swift 4.2
Ascend 910B
megatron sft qwen3.5 35b-a3b

Additional Information / 补充信息

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions