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

106.61.**9 Posted at: 4 hours 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
......
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=True,self.spk_insert=True
[TaskCfgSTT]
原始输入文件名: E:/DownLoad/DCL/5tHt9pEx6.mp4,
输出结果保存到文件夹: D:/win-pyvideotrans-v4.10/output/recogn,
临时文件夹: D:/win-pyvideotrans-v4.10/tmp/3656/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 4 hours ago

这是由 openai-whisper 在 CUDA 解码时显存不足或 GPU 计算异常导致的 NaN 输出,通常表现为 logits 出现 nanlarge-v3-turbo 模型需要较大显存,显存不足时 Whsiper 推理会得到无效值并中断。

解决方案:

  1. 先换成更小模型:在语音识别渠道中将模型从 large-v3-turbo 改为 mediumsmallbase,确认能否通过。
  2. 如果必须用大模型,请降低显存占用:

    • 打开 菜单 → 工具 → 高级选项 → 语音识别参数
    • 计算数据类型 设为 float16(显卡)或 int8(最省显存)
    • 识别准确度beam_size识别准确度best_of 都设为 1
    • 关闭 启用上下文感知
  3. 确认显卡驱动和 CUDA 环境正常,并关闭其他占用显存的程序。
  4. 如果显卡显存确实不足(large-v3-turbo 约需 6GB 空闲显存),可取消勾选 CUDA加速 改用 CPU 运行,但速度会明显变慢。
  5. 若以上方法仍失败,建议改回默认推荐的 faster-whisper(内置) 渠道,速度更快且更稳定。

请查阅相关文档:

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