#3345 配音阶段出错 [clone-voice(本地)] {'code': 6, 'msg': 'CUDA error: no kernel image is available for execution on the device CUDA k

138.2* Posted at: 2 days ago 👁33

配音阶段出错 [clone-voice(本地)] {'code': 6, 'msg': 'CUDA error: no kernel image is available for execution on the device CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect. For debugging consider passing CUDA_LAUNCH_BLOCKING=1. Compile with TORCH_USE_CUDA_DSA to enable device-side assertions. '}
Traceback (most recent call last):
File "videotrans\task\job.py", line 214, in run
File "videotrans\task\trans_create.py", line 677, in dubbing
File "videotrans\task\trans_create.py", line 953, in _tts
File "videotrans\tts\__init__.py", line 337, in run
File "videotrans\tts\_base.py", line 189, in run
File "tenacity\__init__.py", line 480, in call
File "videotrans\tts\_clone.py", line 70, in _run
RuntimeError: {'code': 6, 'msg': 'CUDA error: no kernel image is available for execution on the device CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect. For debugging consider passing CUDA_LAUNCH_BLOCKING=1. Compile with TORCH_USE_CUDA_DSA to enable device-side assertions. '}
TaskCfg(cache_folder='D:/pyVideoTran/win-pyvideotrans-v3.96-24/tmp/36748/e6bb57afc6', target_dir='D:/tkhub/downloads/_video_out/douyin_阳光科普_7572841804799624128-mp4', remove_noise=False, is_separate=False, detect_language='zh-cn', subtitle_language=None, source_language='简体中文', target_language='英语', source_language_code='zh-cn', target_language_code='en', source_sub='D:/tkhub/downloads/_video_out/douyin_阳光科普_7572841804799624128-mp4/zh-cn.srt', target_sub='D:/tkhub/downloads/_video_out/douyin_阳光科普_7572841804799624128-mp4/en.srt', source_wav='D:/pyVideoTran/win-pyvideotrans-v3.96-24/tmp/36748/e6bb57afc6/zh-cn.wav', source_wav_output='D:/tkhub/downloads/_video_out/douyin_阳光科普_7572841804799624128-mp4/zh-cn.m4a', target_wav='D:/pyVideoTran/win-pyvideotrans-v3.96-24/tmp/36748/e6bb57afc6/target.wav', target_wav_output='D:/tkhub/downloads/_video_out/douyin_阳光科普_7572841804799624128-mp4/en.m4a', subtitles='', novoice_mp4='D:/pyVideoTran/win-pyvideotrans-v3.96-24/tmp/36748/e6bb57afc6/novoice.mp4', noextname='douyin_阳光科普_7572841804799624128', shibie_audio=None, targetdir_mp4='D:/tkhub/downloads/_video_out/douyin_阳光科普_7572841804799624128-mp4/douyin_阳光科普_7572841804799624128.mp4', instrument=None, vocal=None, back_audio='', background_music=None, app_mode='biaozhun', subtitle_type=1, volume='+0%', pitch='+0Hz', voice_rate='+0%', voice_role='clone', copysrt_rawvideo=False, clear_cache=True, translate_type=5, tts_type=25, recogn_type=0, model_name='medium', voice_autorate=True, video_autorate=True, is_cuda=True, name='D:/tkhub/downloads/测试/douyin_阳光科普_7572841804799624128.mp4', basename='douyin_阳光科普_7572841804799624128.mp4', ext='mp4', dirname='D:/tkhub/downloads/测试', shound_del_name=None, uuid='e6bb57afc6', remove_silent_mid=False, align_sub_audio=True, enable_diariz=True, nums_diariz=1, rephrase=0, only_out_mp4=True, fix_punc=False, recogn2pass=True)

5 Replies

该错误是由于你的显卡与 clone-voice 声音克隆模型所需的 CUDA 计算能力不匹配导致的。具体报错信息 no kernel image is available for execution on the device 表明当前安装的 PyTorch/CUDA 版本无法在你的显卡上运行。

解决方案:

  1. 检查显卡型号和计算能力:使用 nvidia-smi 命令查看你的显卡型号,并搜索该型号对应的 CUDA 计算能力(Compute Capability)。例如,较新的 RTX 40 系列显卡可能需要更高版本的 PyTorch。
  2. 更新 PyTorch 版本:clone-voice 项目可能内置了特定版本的 PyTorch。你需要根据你的显卡计算能力,手动安装或更新 clone-voice 环境中的 PyTorch 版本。

    • 访问 PyTorch 官网 (https://pytorch.org/get-started/locally/)。
    • 根据你的 CUDA 版本(如 CUDA 12.1)和计算能力,选择正确的安装命令。例如,对于 CUDA 12.1,命令可能是 pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
    • 在 clone-voice 项目的虚拟环境或 Conda 环境中执行此命令。
  3. 降级使用其他配音渠道:如果更新 PyTorch 后问题依旧,或者操作复杂,建议暂时使用其他兼容性更好的配音渠道。

    • 推荐:切换到 Edge-TTS(免费,无需配置 CUDA)或 F5-TTS(支持克隆,但需独立部署其 API 服务)。
    • 在 pyVideoTrans 的“配音设置”中,将“配音渠道”从 clone-voice(本地) 更改为上述渠道之一。

根本原因:此错误通常发生在使用较新架构(如 Ada Lovelace 架构的 RTX 40 系)或较旧架构的显卡时,预编译的 PyTorch 二进制包未包含针对你显卡计算能力的 CUDA 内核。需要安装正确版本的 PyTorch。

请查阅相关文档:

rtx5060ti 选什么 请给我下载命令

你的 RTX 5060 Ti 显卡属于最新的 Blackwell 架构,其 CUDA 计算能力可能过高,导致当前 clone-voice 环境中的 PyTorch 版本不包含对应的内核。你需要安装支持 CUDA 12.4 及以上版本且包含新架构内核的 PyTorch。

解决方案:

  1. 安装支持 CUDA 12.4 的 PyTorch:根据 PyTorch 官网,目前(截至知识库更新时)稳定版主要支持 CUDA 12.1。对于 RTX 50 系列,你可能需要安装 Nightly(预览)版本或特定构建。访问 PyTorch 官网获取最新命令。
  2. 下载命令(推荐)

    • CUDA 12.4 (稳定版):如果 PyTorch 已发布稳定版,命令可能类似:
      pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
    • CUDA 12.4 (Nightly 版):如果稳定版未发布,使用 Nightly 版本:
      pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu124
    • CUDA 12.1 (备用):如果 12.4 版本不可用,先尝试 CUDA 12.1 的稳定版,但可能仍会报错:
      pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
  3. 执行环境必须在 clone-voice 项目自身的 Python 虚拟环境或 Conda 环境中运行上述命令,而不是在 pyVideoTrans 的环境中。你需要进入 clone-voice 的安装目录,激活其环境后再安装。
  4. 备选方案:如果上述步骤复杂或无效,强烈建议你暂时放弃 clone-voice,改用其他配音渠道,如 Edge-TTS(免费,无需配置)或 F5-TTS(支持克隆,需独立部署)。在 pyVideoTrans 的配音设置中直接切换即可,这是最快解决当前翻译任务的方法。

根本原因:RTX 50 系列显卡的计算能力(如 9.0)可能超出了 clone-voice 所依赖的预编译 PyTorch 二进制包的支持范围,导致“no kernel image”错误。需要安装包含新架构内核的 PyTorch 版本。

请查阅相关文档:

具体怎么安装

要解决 RTX 5060 Ti 显卡运行 clone-voice 的 CUDA 内核错误,核心是进入 clone-voice 项目的 Python 环境,安装一个支持新显卡架构的 PyTorch 版本。以下是具体步骤:

  1. 定位并进入 clone-voice 环境

    • 找到你安装 clone-voice 的目录。
    • 如果 clone-voice 使用 Conda 环境,通常目录下会有 environment.ymlconda 相关文件。打开命令提示符 (CMD) 或 Anaconda Prompt,导航到该目录,然后激活环境。命令通常为:

      conda activate [你的环境名]

      如果环境名未知,可以尝试 conda info --envs 查看所有环境。

    • 如果 clone-voice 使用 venvvirtualenv 虚拟环境,进入该环境的 Scripts 目录(Windows)或 bin 目录(Mac/Linux),然后运行 activate(Windows)或 source activate(Mac/Linux)。
  2. 在激活的环境中安装 PyTorch

    • 确保环境激活后,命令行提示符前显示环境名称。
    • 执行以下命令之一来安装支持 CUDA 12.4 的 PyTorch(这是目前最可能支持 RTX 50 系列的版本):

      • 稳定版(如果已发布)

        pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
      • Nightly 预览版(如果稳定版未发布或无效)

        pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu124
    • 如果 CUDA 12.4 版本安装失败或不可用,可以尝试安装 CUDA 12.1 的稳定版作为测试,但可能仍会报错:

      pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
  3. 验证安装并重启服务

    • 安装完成后,在 Python 交互环境中输入 import torch; print(torch.cuda.is_available()) 应返回 True
    • 关闭并重新启动 clone-voice 的 API 服务。
  4. 备选方案(推荐)

    • 如果上述步骤复杂或安装后问题依旧,最快捷的解决方案是直接更换 pyVideoTrans 中的配音渠道
    • 在 pyVideoTrans 的“配音设置”中,将“配音渠道”从 clone-voice(本地) 切换到 Edge-TTS(免费,无需配置)或配置好的 F5-TTS(支持声音克隆)。
    • 这可以让你立即继续视频翻译任务,无需等待显卡兼容性问题解决。

重要提醒:此操作仅针对 clone-voice 项目本身。pyVideoTrans 主程序使用的 CUDA 环境(如为 faster-whisper 加速)是独立的,不受此影响。

请查阅相关文档:

Post Your Reply
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Related resource