#6741 语音识别阶段出错[openai-whisper(内置)] Expected parameter logits (Tensor of shape (1, 51866)) of distribution Categorical(logits:

106.61.**9 Posted at: 1 hour ago

语音识别阶段出错[openai-whisper(内置)] Expected parameter logits (Tensor of shape (1, 51866)) of distribution Categorical(logits: torch.Size([1, 51866])) to satisfy the constraint IndependentConstraint(Real(), 1), but found invalid values:
tensor([[nan, nan, nan, ..., nan, nan, nan]], device='cuda:0'):Traceback (most recent call last):
File "videotrans\process\stt_openai.py", line 104, in openai_whisper
File "whisper\transcribe.py", line 295, in transcribe
File "whisper\transcribe.py", line 201, in decode_with_fallback
File "D:\win-pyvideotrans-v4.10\_internal\torch\utils\_contextlib.py", line 116, in decorate_context

return func(*args, **kwargs)

File "whisper\decoding.py", line 824, in decode
File "D:\win-pyvideotrans-v4.10\_internal\torch\utils\_contextlib.py", line 116, in decorate_context

return func(*args, **kwargs)

File "whisper\decoding.py", line 737, in run
File "whisper\decoding.py", line 703, in _main_loop
File "whisper\decoding.py", line 283, in
......
eter logits (Tensor of shape (1, 51866)) of distribution Categorical(logits: torch.Size([1, 51866])) to satisfy the constraint IndependentConstraint(Real(), 1), but found invalid values:
tensor([[nan, nan, nan, ..., nan, nan, nan]], device='cuda:0'):Traceback (most recent call last):
File "videotrans\process\stt_openai.py", line 104, in openai_whisper
File "whisper\transcribe.py", line 295, in transcribe
File "whisper\transcribe.py", line 201, in decode_with_fallback
File "D:\win-pyvideotrans-v4.10\_internal\torch\utils\_contextlib.py", line 116, in decorate_context

return func(*args, **kwargs)

File "whisper\decoding.py", line 824, in decode
File "D:\win-pyvideotrans-v4.10\_internal\torch\utils\_contextlib.py", line 116, in decorate_context

return func(*args, **kwargs)

File "whisper\decoding.py", line 737, in run
File "whisper\decoding.py", line 703, in _main_loop
File "whisper\decoding.py", line 283, in update
File "D:\win-pyvideotrans-v4.10\_internal\torch\distributions\categorical.py", line 73, in init

super().__init__(batch_shape, validate_args=validate_args)

File "D:\win-pyvideotrans-v4.10\_internal\torch\distributions\distribution.py", line 72, in init

raise ValueError(

ValueError: Expected parameter logits (Tensor of shape (1, 51866)) of distribution Categorical(logits: torch.Size([1, 51866])) to satisfy the constraint IndependentConstraint(Real(), 1), but found invalid values:
tensor([[nan, nan, nan, ..., nan, nan, nan]], device='cuda:0')
[SpeechToText]语音转录: self.out_format='srt',self.copysrt_rawvideo=False,self.spk_insert=True
[TaskCfgSTT]
原始输入文件名: E:/DownLoad/DCL/5tHt9pEx6.mp4,
输出结果保存到文件夹: D:/win-pyvideotrans-v4.10/output/recogn,
临时文件夹: D:/win-pyvideotrans-v4.10/tmp/8612/bb09353d7d
已启用CUDA加速
未选 降噪
语音识别:openai-whisper(内置), large-v3-turbo 断句方式:默认断句
发音语言:自动检测
未选 降噪


=
system:Windows-10-10.0.26100-SP0
version:v4.10
frozen:True
language:zh
root_dir:D:/win-pyvideotrans-v4.10

1 Replies

#1 DeepSeek reply at 1 hour ago

这通常是 openai-whisper 在 CUDA 推理过程中发生数值溢出(NaN)导致的,常见原因集中在显卡显存不足、CUDA/cuDNN 环境不匹配或模型计算不稳定。

建议按顺序排查:

  1. 关闭“CUDA加速”改用 CPU 试一次;若 CPU 正常,可确定是 CUDA/显卡环境问题。
  2. 若必须用 GPU,先确认显卡驱动已更新,并按要求安装 CUDA 12.8 和 cuDNN 9.11+,且环境变量已包含 bin/lib 路径。
  3. 将语音识别渠道切换为 faster-whisper(内置),模型仍选 large-v3-turbo,观察是否复现(faster-whisper 对显存/CUDA 兼容性更稳健)。
  4. 降低资源占用:模型换为 large-v3 或 medium;菜单 → 工具 → 高级选项 → 语音识别参数,将“计算数据类型”改为 float16 或 int8,将 beam_size/best_of 都设为 1,并关闭“启用上下文感知”。
  5. 若显存低于 8GB,请改用 small/medium 模型,避免 large-v3 系列爆显存。
  6. 检查模型文件是否损坏:删除已下载的 openai-whisper large-v3-turbo 模型文件,重新下载后重试。

如果以上仍无法解决,请提供 logs/ 目录下最新日志文件底部约30行,并说明显卡型号、显存大小、驱动版本。

请查阅相关文档:

Thinking...
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.

Dondate via ko-fi.com

Related resource