> 技术文档 > fish-speech 在50系列显卡使用 --compile加速兼容

fish-speech 在50系列显卡使用 --compile加速兼容

#环境说明

GPU: NVIDIA GeForce RTX 5080 Laptop GPU (sm_120)

win11家庭版 24H2

#问题汇总

baize.exceptions.HTTPException: (500, \"\'RuntimeError: `ptxas` failed with error code 4294967295: \\\\n\\\\n\'\")

问题汇总

1 baize.exceptions.HTTPException: (500, \"\'RuntimeError: `ptxas` failed with error code 4294967295: \\\\n\\\\n\'\")

说明:

PTX 汇编器)执行失败,返回了错误代码 4294967295

  • ptxas 是 NVIDIA CUDA 工具链中的 PTX (Parallel Thread Execution) 汇编器。当 CUDA 代码(无论是直接写的 .cu 文件还是通过 torch.compile 生成的)被编译时,会先生成 PTX 代码,然后 ptxas 将其汇编成二进制代码(SASS)。
  • 错误代码 4294967295 是一个很大的无符号整数,通常表示 -1(如果按有符号整数解释)或者表示一个通用的、未指定的失败。这通常意味着 ptxas 在执行过程中遇到了严重问题,可能是输入的 PTX 代码有严重错误,或者 ptxas 本身或其依赖项(如驱动)有问题。

baize.exceptions.HTTPException: (500, \'\"backend=\\\'inductor\\\' raised:\\\\nImportError: DLL load failed while importing libtriton: 找不到指定的模块。\\\\n\\\\n\\\\nYou can suppress this exception and fall back to eager by setting:\\\\n import torch._dynamo\\\\n torch._dynamo.config.suppress_errors = True\\\\n\"\')

说明:

DLL load failed while importing libtriton: 找不到指定的模块。

这个错误通常发生在 Windows 系统上,尤其是在使用某些版本的 PyTorch 或与 CUDA 相关的库时。Triton 是 torch.compile(特别是使用 \'inductor\' 后端时)依赖的一个库,用于代码生成和优化。DLL 加载失败意味着 Python 无法找到或加载 Triton 所需的某个动态链接库文件。

这很可能是 PyTorch 的编译优化功能与你的系统环境(特别是 CUDA/Triton 库)不兼容导致的。

 

\'sm_120\' is not a recognized processor for this target (ignoring processor)

ptxas fatal : Value \'sm_120\' is not defined for option \'gpu-name\'

说明:

在编译 CUDA 代码时,编译器遇到了一个它不识别或不支持的 GPU 架构目标 sm_120

  1. ptxas fatal : Value \'sm_120\' is not a recognized processor for this target (ignoring processor): 这是致命错误,导致编译过程失败。ptxas 是 PTX (Parallel Thread Execution) 汇编器,它明确指出 sm_120 不是一个有效的 GPU 架构名称。
  2. sm_120 是什么?: sm_XX 是 NVIDIA 用来标识其 GPU 架构代号的命名方式(Streaming Multiprocessor)。例如:
  • sm_50: Maxwell
  • sm_60, sm_61, sm_62: Pascal
  • sm_70, sm_75: Volta
  • sm_80, sm_86, sm_89: Ampere
  • sm_90, sm_90a: Hopper
  • sm_89: Ada Lovelace (用于消费级 RTX 40 系列)

说明:

PyTorch 或 CUDA 工具链 的 编译错误

 

baize.exceptions.HTTPException: (500, \'\"FileNotFoundError: [Errno 2] No such file or directory: \\\'C:\\\\\\\\\\\\\\\\Users\\\\\\\\\\\\\\\\87753\\\\\\\\\\\\\\\\AppData\\\\\\\\\\\\\\\\Local\\\\\\\\\\\\\\\\Temp\\\\\\\\\\\\\\\\torchinductor_87753\\\\\\\\\\\\\\\\triton\\\\\\\\\\\\\\\\0\\\\\\\\\\\\\\\\QAVTUZC727AGUBQDWKDTRPI2HVHXXOE4SLZEB75DZ42XLWID4WLA\\\\\\\\\\\\\\\\tmp.pid_17188_7d16f0a2-f024-44fd-a2e2-4735300a49fb\\\\\\\\\\\\\\\\triton_red_fused__softmax__to_copy_argmax_clamp_div_exponential_index_put_lift_fresh_masked_fill_sub_44.ttir\\\'\\\\n\"\')

说明:

  1. Windows 长路径限制:
    • Windows 对文件路径长度有限制(传统上限是 260 个字符)。虽然现代 Windows 和 Python 通常能处理长路径,但如果某些组件或设置未正确配置,极长的路径(如此错误中的路径)仍可能引发问题。

 

# 错误总结:

1 编译错误:( cuda架构与pytorch版本不兼容 , cuda编译环境不兼容 )

2 window路径长度限制

# 解决方式

 

配置正确的python环境

目前支持50系列的nvidia的pytorch版本为 2.7.1 参考官网信息

windows环境下:

python >= 3.10

cuda tool 需要 12.8

pytorch torchaudio == 2.7.1+cu128

torch-complex == 0.4.4

xformers == 0.0.30

特别包 官方只支持liunx ,windows需要手动:

flash_attn == 2.7.4.post1 ->https://github.com/kingbri1/flash-attention/releases

triton-windows == 3.3.1.post19 -> https://github.com/woct0rdho/triton-windows/release ( 2025年五月份补丁支持了s_120架构 并上传了pipy)

特别注意: triton 和 triton-windows 是同一技术的不同版本;

triton 官方仅支持liunx , windows 版本由开源社区维护 triton-windows , 类似(triton-3.0.0-cp311-cp311-win_amd64.whl) 都是liunx版本在windows跳过编译错误打包成的, 实际无效, 且不要在pip环境同时存在这俩;

配置正确的C++环境 

2.1 安装visual studio2022 ,选择 windows桌面开发 , 重点勾选:

配置编译环境变量 

默认visual studio2022安装路径在:

C:\\Program Files\\Microsoft Visual Studio\\2022\\Community

windows sdk :

C:\\Program Files (x86)\\Windows Kits\\10

参考我的配置:

C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.44.35207\\bin\\Hostx64\\x64
C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.26100.0\\x64

C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.44.35207\\lib\\x64
C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.26100.0\\ucrt\\x64
C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.26100.0\\um\\x64

C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.44.35207\\include
C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.26100.0\\ucrt
C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.26100.0\\um
C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.26100.0\\winrt
C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.26100.0\\cppwinrt
C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.26100.0\\shared

 CMD 命令行输入: cl ,输出 Microsoft (R) C/C++ Optimizing Compiler ... 即可

安装正确的cuda tool工具链 ( nvidia官网下载 )

默认环境路径配置会在安装时自动设置( 如果没有请手动设置 )

出现下面即可

修改windows系统限制 

Win + R,输入 gpedit.msc

计算机配置 -> 管理模板 -> 系统 -> 文件系统

  • 找到策略:启用 Win32 长路径
  • 将其设置为 已启用
  • 更改后需要重启才能完全生效。

windows11家庭版开启gpedit.msc的方法:

新建 gpedit.bat 

编辑:

@echo off
pushd \"%~dp0\"
dir /b %systemroot%\\Windows\\servicing\\Packages\\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~3*.mum >gp.txt
dir /b %systemroot%\\servicing\\Packages\\Microsoft-Windows-GroupPolicy-ClientTools-Package~3*.mum >>gp.txt
for /f %%i in (\'findstr /i . gp.txt 2^>nul\') do dism /online /norestart /add-package:\"%systemroot%\\servicing\\Packages\\%%i\"
pause

以管理员身份运行!

其他操作:

确保以上所有动作都正确, 清理或删除原编译生产的缓存文件夹:

C:\\Users\\87753\\AppData\\Local\\Temp\\torchinductor_* ( 87753 是我的电脑管理员账号名 )

清理之前的 triton 包残留:

pip uninstall triton triton-windows

pip install --force-reinstall --no-deps triton-windows==3.3.1.post19