ImportError: DLL load failed while importing _fused: The specified module could not be found.

这个报错通常出现在 Windows 环境下使用 ComfyUI WanVideoWrapper 并启用 SageAttention 时,实际是 Triton 的编译环境或版本不匹配导致 _fused 模块无法加载。优先检查 Triton 是否可用,并考虑降级 SageAttention 与 Trit

快速结论:这个报错通常出现在 Windows 环境下使用 ComfyUI WanVideoWrapper 并启用 SageAttention 时,实际是 Triton 的编译环境或版本不匹配导致 _fused 模块无法加载。优先检查 Triton 是否可用,并考虑降级 SageAttention 与 Triton。

适用环境:Windows;ComfyUI WanVideoWrapper;已安装 SageAttention 与 Triton;有用户使用 RTX 2070 Super Mobile,并使用 main.py --use-sage-attention --windows-standalone-environment 启动。

最快修复方案:Issue 中有用户通过降级到 sageattention==1.0.6 与 Triton 3.1.0 解决;也可先运行 triton-windows 提供的测试脚本确认 Triton 工作正常。

注意事项:降级并非唯一路径,Issue 中另一位用户最终自行解决了问题但未说明具体操作;若 Triton 本身配置不正确,仅降级 SageAttention 可能无效。

问题场景

用户在 ComfyUI 中运行 WanVideoWrapper 相关节点,或通过 python main.py --use-sage-attention --windows-standalone-environment 启动时,尝试启用 SageAttention 加速,结果加载失败。

报错原文

ImportError: DLL load failed while importing _fused: The specified module could not be found.

原因分析

可能原因:该错误与 SageAttention 依赖的 Triton 及其编译环境相关。_fused 模块通常是 SageAttention 或 Triton 在 Windows 上编译/加载的扩展,缺失正确的编译环境(如 cl.exe 不可用)或依赖版本不兼容时,就会加载失败。讨论中提到用户所在 Python venv 中 where cl.exe 找不到编译器,说明编译工具链配置可能不完整。

环境排查

  • 操作系统是否为 Windows。
  • 是否安装了 SageAttention2 或 SageAttention。
  • 已安装的 SageAttention 版本(如 1.0.6)。
  • 已安装的 Triton 版本(如 3.1.0)。
  • Python 虚拟环境中 where cl.exe 是否能正确输出编译器路径。
  • 显卡架构是否与当前 SageAttention 预编译版本兼容(有 RTX 2070 Super Mobile 用户遇到架构不兼容提示)。
  • 运行 triton-windows 官方测试脚本是否通过:https://github.com/woct0rdho/triton-windows?tab=readme-ov-file#test-if-it-works

解决步骤

  1. 先确认 Triton 是否能正常工作:运行 triton-windows 仓库提供的测试脚本,排除 Triton 本身安装或配置问题。
  2. 如果 Triton 测试失败,检查并修复编译环境,确保 cl.exe 在 Python venv 中可被找到。
  3. 如果 Triton 测试通过但仍报错,可优先尝试将 SageAttention 降级到 sageattention==1.0.6,并将 Triton 降级到 3.1.0。
  4. 如果显卡架构较旧(如 RTX 2070 Super Mobile),更应优先尝试上述降级组合,因为有用户反馈架构不兼容问题通过降级解决。
  5. 如果以上均无效,可回到原 Issue 查看是否有人补充了其他解决方案。

验证方法

重新启动 ComfyUI 或运行 python main.py --use-sage-attention --windows-standalone-environment,确认不再出现 ImportError: DLL load failed while importing _fused,且 SageAttention 相关功能可以正常调用。

参考来源

kijai/ComfyUI-WanVideoWrapper #84

GamsGo AI

AI 工具推荐

想把多个 AI 模型放在一个入口?

GamsGo AI 集成 ChatGPT、DeepSeek、Gemini、Claude、Midjourney、Veo 等常用模型,适合写作、绘图、视频和日常 AI 工作流。

了解 GamsGo AI

推广链接:通过此链接购买,我可能获得佣金,不影响你的价格。

这个方案解决了吗?

celebrityanime
celebrityanime
文章: 25655

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注