已关闭
[Bug-Report|缺陷反馈]:torch_extensions懒加载缺失_ensure_initialized调用 #5582
weihao18创建于  28 天前关闭于  27 天前
weihao18成员
28 天前 创建

Thanks for sending an issue! Please fill in the following template to help quickly solve your problem.

Describe the current behavior / 问题描述 (Mandatory / 必填)

https://gitcode.com/cann/ops-transformer/pull/12563
懒加载的修复,缺失_ensure_initialized调用,导致功能异常

参考如下改法,调用_ensure_initialized() 保证初始化
apply_rotary_pos_emb_grad_op_builder = ApplyRotaryPosEmbGradOpBuilder()
apply_rotary_pos_emb_grad_op_builder._ensure_initialized()

Environment Information / 环境信息 (Mandatory / 必填)

如上

Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)

如上

Describe the expected behavior / 预期结果 (Mandatory / 必填)

如上

如上

Special notes for this issue/备注 (Optional / 选填)

likedislike
Wweihao18成员
28 天前 添加了label:bug-report
Wweihao18成员
28 天前 关联了pull request:fix: torch_extension 懒加载缺失的算子补调 _ensure_initialized 保证 schema 注册
游震成员
28 天前 评论:

/assign @weihao18

likedislike
CANN-robotCANN-robot成员
27 天前 关闭了 issue
CANN-robotCANN-robot成员
27 天前 添加了label:resolved
周云飞
周云飞成员
5 天前 评论:

Issue中提到的 ApplyRotaryPosEmbGradOpBuilder 在固定源码快照 29f3b8185af2ce772af1ba7b9ddf2b47f2100a01 的 Python wrapper 中已显式调用 _ensure_initialized(),在接口使用前显式初始化 lazy builder(源码)。仓库提交 6ef2df646 对该算子补入此调用。

这是Python注册/初始化路径的代码核对,没有重新执行wheel加载。结论限定在固定源码快照,不能替代对具体已安装包的核实。

原生关联 PR #12693 已合入 master。实际diff在多个 torch_extension OpBuilder 实例化后调用 _ensure_initialized(),覆盖正文涉及的 wrapper;本次未导入或执行PyTorch扩展。

likedislike