#7007 parallel_for failed: cudaErrorInvalidDevice: invalid device ordinal:Traceback (most recent call last): File

104.28**3 Posted at: 1 hour ago

parallel_for failed: cudaErrorInvalidDevice: invalid device ordinal:Traceback (most recent call last):
File "videotrans\process\stt_faster.py", line 184, in faster_whisper
File "faster_whisper\transcribe.py", line 1851, in restore_speech_timestamps
File "faster_whisper\transcribe.py", line 1190, in generate_segments
File "faster_whisper\transcribe.py", line 1400, in encode
RuntimeError: parallel_for failed: cudaErrorInvalidDevice: invalid device ordinal

Traceback (most recent call last):
File "videotrans\task\only_one.py", line 70, in run
File "videotrans\task\_stage_recogn.py", line 63, in recogn
File "videotrans\recognition\__init__.py", line 211, in run
File "videotrans\recognition\_base.py", line 98, in run
File "videotrans\recognition\_whisper.py", line 41, in _exec
File "videotrans\recognition\_whisper.py", line 130, in _faster
File "videotrans\configure\base.py", line 270, in _new_process
videotrans.configure.excepts.VideoTransError: parallel_for failed: cudaErrorInvalidDevice: invalid device ordinal:Traceback (most recent call last):
File "videotrans\process\stt_faster.py", line 184, in faster_whisper
File "faster_whisper\transcribe.py", line 1851, in restore_speech_timestamps
File "faster_whisper\transcribe.py", line 1190, in generate_segments
File "faster_whisper\transcribe.py", line 1400, in encode
RuntimeError: parallel_for failed: cudaErrorInvalidDevice: invalid device ordinal

cfg=[TaskCfgVTT]当前工作模式: 翻译视频 单视频模式
原始输入文件名: D:/Py/youtube/ok/downloads/xnyXBUElx-w/video.mp4,
输出结果保存到文件夹: D:/Py/youtube/ok/downloads/xnyXBUElx-w/video-mp4,
临时文件夹: D:/AI/pyVideoTrans/tmp/16492/5f54ccaddc
已选 清理已存在
已启用CUDA加速
未选 降噪
语音识别:faster-whisper(内置), large-v3-turbo, 发音语言: 英语, 断句方式:默认断句
翻译渠道:微软(免费),原始语言:英语,目标语言:简体中文, 已选 发送完整字幕
配音渠道:Edge-TTS(免费), 角色:Xiaoxiao(Female/CN), 配音语言:简体中文, 未选 二次语音识别
音量:+0%, 语速:+0%, 已选 音频加速, 已选 视频慢速
字幕: 嵌入硬字幕(双) 目标语言在下双字幕
已选 分离人声与背景声, 已选 重新嵌入背景声, 背景音量0.8, 背景声音时长 短于 视频时长时: 拉长(降速播放),存在分离后的纯净人声文件,存在分离后的背景声音文件
代理地址:http://127.0.0.1:10808


=
system:Windows-10-10.0.19044-SP0
version:v4.11
frozen:True
language:zh
root_dir:D:/AI/pyVideoTrans

1 Replies

#1 DeepSeek reply at 1 hour ago

这是 CUDA 设备索引无效导致的错误,常见于显卡驱动/CUDA 环境异常、多卡识别错误或子进程无法正确获取 GPU 序号。

解决方案(按顺序尝试)

  1. 先验证 CUDA 环境
    打开命令行(CMD),执行:

    nvidia-smi
    nvcc -V

    确认能正常输出显卡信息且 CUDA 版本 ≥ 12.8。如果 nvidia-smi 报错或看不到显卡,说明驱动未正确安装,请更新 NVIDIA 驱动。

  2. 关闭多显卡模式
    进入 菜单 → 工具 → 高级选项 → 通用,检查是否勾选了「多显卡模式」。若你只有一张显卡,必须取消勾选,并将「GPU同时任务数」设为 1,重启软件后再试。
  3. 检查 CUDA 环境变量
    确保系统环境变量的 Path 中已包含 CUDA 的 binlib 目录(例如 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\bin)。缺少时子进程可能无法定位 GPU 序号。
  4. 临时改用 CPU 运行
    在主界面语音识别行,取消勾选「CUDA加速」,改用 CPU 方式进行识别。若能正常完成,则确认问题确实出在 CUDA 设备识别上。
  5. 降低模型规模
    当前使用 large-v3-turbo,对显存要求较高。若显存不足也可能触发设备错误,尝试换用 mediumsmall 模型,并确认「计算数据类型」设为 float16(在高级选项→语音识别参数中)。
  6. 重启软件后重试
    CUDA 设备序号错误有时是临时性的子进程残留导致,关闭所有 sp.exe 后重新启动。

请查阅相关文档:

Thinking...
Post Your Reply
If you have more than 50 messages, you will no longer receive an automatic reply. Please ask a new question!
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.

Dondate via ko-fi.com

Related resource