Skip to content

fix: Windows 上 FastSAC 训练因缺少 triton 导致 torch.compile 必现失败 #28

Description

@wlgys8

在 Windows 上通过 cuda profile 安装后训练(microduck-walk-flat / motrix.fastsac)必现失败,collector 进程在 warmup 推理时报 TritonMissing

现象

torch._inductor.exc.TritonMissing: Cannot find a working triton installation. Either the package is not installed or it is too old.

调用链:run_collector_processcollector.warmup_inference()torch.compile(..., mode="reduce-overhead") → inductor 找不到 triton。

根因

  1. FastSAC 默认开启 torch.compile:configs/algo_base/motrix.fastsac.yamlagent.compile: truetrainer.async_options.collector_compile: true(均仅在 CUDA 生效)。mode="reduce-overhead" 走 inductor 后端,编译 kernel 依赖 triton。
  2. Linux 上 torch 的包依赖自带 triton(metadata 限定 platform_system == "Linux"),装完 torch 就有;但 PyPI 官方 triton 没有 Windows wheel,Windows 版 torch 也不声明该依赖。
  3. 因此 Windows 上无论安装流程多干净,triton 都必然缺失,TritonMissing 是必现的——不是安装脚本漏装。

立即可用的 workaround(无需装任何东西)

关闭两个 compile 开关(功能一致,无 CUDA graph 加速,训练速度会有损失):

python scripts/train.py task=microduck-walk-flat/motrix.fastsac play=true algo.agent.compile=false algo.trainer.async_options.collector_compile=false

修复选项

方案 做法 代价
A. 引入社区 wheel cuda extra 增加 triton-windows>=3.3,<3.4; sys_platform == 'win32'(torch 2.7.0 对应 Triton 3.3) triton-windows 要求用户安装 MSVC + Windows SDK(VS Build Tools);版本须与 torch 严格配套,升级 torch 需同步 pin
B. 平台守卫(推荐) 启用 compile 的条件改为 device.type == "cuda" and sys.platform != "win32" Windows 训练慢 20-40%,但零门槛可跑
C. 文档标注 README / installation 文档写明 Windows 需用上面的 override 关闭 compile

建议 B + C 落地;需要 Windows 上保留 compile 性能的用户再按 A 的说明自行安装 VS Build Tools + triton-windows。

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions