已关闭
【26.2.0众测】Guard Filter 要求 PyTorch≥2.9.0,但《软件安装》配套表把 2.7.1 列为 TorchNPU 26.1.0 的配套版本 #4777
fpwdh创建于  9月14日关闭于  14 天前
fpwdh
fpwdh
9月14日 创建

问题描述(文档一致性 / 新手易踩)

《Guard Filter》文档在“约束说明”中写明:

  • PyTorch版本:必须为2.9.0及以上版本。

而《软件安装》的“方式一:离线安装(Whl)”表格中,TorchNPU 26.1.0 同时列出了 5 个 PyTorch 配套版本
(2.7.1 / 2.9.0 / 2.10.0 / 2.11.0 / 2.12.0),其中 2.7.1 排在表格前部、也是最常见的“默认”选择,
安装表格本身没有任何提示说明“Guard Filter 需要 ≥2.9.0”。

复现步骤

  1. 按《软件安装》安装 torch 2.7.1 + torch_npu 2.7.1.post10(TorchNPU 26.1.0 的 2.7.1 配套包)。
  2. 按《Guard Filter》文档“使用示例1”编写脚本:
import torch, torch_npu

def filter_dict_guards(entries):
    return [entry.guard_type not in {"DICT_VERSION"} for entry in entries]

model = MyModel().npu()
compiled = torch.compile(model, options={"guard_filter_fn": filter_dict_guards})
  1. 运行:
RuntimeError: Unexpected optimization option guard_filter_fn, known options are ['TYPE_CHECKING', ...]

(错误来自 torch/__init__.py 的 _TorchCompileInductorWrapper.apply_options,说明该 PyTorch 版本根本不认识这个选项。)

期望结果

文档能明确告知:使用 Guard Filter 必须选择 PyTorch ≥ 2.9.0 的配套行,最好不要和 2.7.1 的安装说明
平铺在同一张表里而不加任何提示(新手很难从“约束说明”里把这个前置条件与安装步骤关联起来)。

影响

众测任务书 5.2 明确要求完成 6 个 Guard Filter 示例,而按文档默认路径安装后这 6 个示例全部无法开工,
需要先自行推断并重装 2.9.0 配套版本,体验割裂。

建议

  1. 在《软件安装》“安装 PyTorch 框架和 TorchNPU 插件”表格上方加醒目提示:
    “如需使用 Guard Filter(guard_filter_fn),必须选择 PyTorch ≥ 2.9.0 的配套行”。
  2. 或在《Guard Filter》“约束说明”里补上对应的 TorchNPU 安装包版本(如 2.9.0.post6 等),并给出直达链接。

(本反馈来自 TorchNPU 26.1.0 众测,材料见 pytorch-ecosystem 仓 01_tasks/2026/torch_npu_public_beta/fpwdh/)

likedislike
TorchNPU-BotTorchNPU-Bot成员
9月14日 添加了label:triage-review
TorchNPU-Bot
TorchNPU-Bot成员
9月14日 评论:

issue待分派,添加triage-review标签

likedislike
fpwdhfpwdh
9月14日 关联了pull request:【TorchNPU 26.1.0 众测】fpwdh 交付材料:安装验证 + 快速入门 + torch.compile 13 示例
TorchNPU-BotTorchNPU-Bot成员
9月14日 添加了label:bot-triaged;删除了label:triage-review
TorchNPU-Bot
TorchNPU-Bot成员
9月14日 评论:

检测到当前 issue 已关联 PR,自动添加标签:bot-triaged

likedislike
ascend-robotascend-robot成员
14 天前 关闭了 issue
ascend-robotascend-robot成员
14 天前 issue状态由 TODO 改变为 DONE
TorchNPU-BotTorchNPU-Bot成员
14 天前 添加了label:help-wanted
TorchNPU-Bot
TorchNPU-Bot成员
14 天前 评论:

检测到社区任务相关 issue,自动添加标签:help-wanted

likedislike
ascend-robotascend-robot成员
14 天前 添加了label:resolved