已关闭
[Feature]: dynamo_export 支持自定义输入 Data 节点名称 #706
hejun99创建于 8月17日关闭于 17 天前
8月17日 添加了label:feature
wj1e
8月18日 评论:
8月18日 评论:
/assign @stevenaw0


8月18日 将 stevenaw0 设为负责人
17 天前 关闭了 issue
17 天前 issue状态由 TODO 改变为 DONE
17 天前 添加了label:resolved
/assign @stevenaw0


感谢您的贡献 🎉!
🚀 特性说明、动机阐述与价值主张
dynamo_export当前不支持指定导出后 AIR/OM 中 Data 节点的名称。Data 节点名由torch.compile在 dynamo trace 阶段自动生成(如arg1_1、arg3_1、primals_1),无法通过 API 控制。导出的 OM 模型在部署链路中,Data 节点名被以下环节直接消费:
当名字为 arg1_1 / arg3_1 时,无法从名字推断语义(actual_seq_lengths?cos?input_ids?),增加了部署维护和问题排查成本。
替代解决方案
感谢您的贡献 🎉!
何其他背景信息
复现方式
import torch import torch_npu from torch_npu.dynamo.torchair import dynamo_export, CompilerConfig class M(torch.nn.Module): def __init__(self): super().__init__() self.linear = torch.nn.Linear(4, 4) def forward(self, input_ids, position_ids, actual_seq_lengths, cos, sin): return self.linear(input_ids.float()) + cos + sin m = M().npu().half() config = CompilerConfig() config.experimental_config.frozen_parameter = 1 dynamo_export( torch.ones(5, 4, dtype=torch.float16).npu(), torch.arange(5, dtype=torch.int64).npu(), torch.tensor([5], dtype=torch.int64).npu(), torch.ones(5, 4, dtype=torch.float16).npu(), torch.ones(5, 4, dtype=torch.float16).npu(), model=m, export_path="./air", export_name="test", dynamic=True, config=config ) # dynamo.pbtxt 中 Data 节点名为 arg1_1 / arg3_1 / arg5_1 / arg8_1 # 而非 input_ids / cos / sin / actual_seq_lengths感谢您的贡献 🎉!