#5206 TaskCfgSTT(uuid='8b280b2ec4', name='E:/DownLoad/DCL/Lucia Gomez - Dick In Ass For the FIRST Time Son causes PAINAL.mp4',

106.61* 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_fun.py", line 102, in openai_whisper
File "whisper\transcribe.py", line 295, in transcribe
File "whisper\transcribe.py", line 201, in decode_with_fallback
File "torch\utils\_contextlib.py", line 116, in decorate_context

return func(*args, **kwargs)

File "whisper\decoding.py", line 824, in decode
File "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 "torch\distributions\categorical.py", line 73, in init

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

File "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')

Traceback (most recent call last):

File "videotrans\task\job.py", line 35, in run

File "videotrans\task\job.py", line 100, in process_task

File "videotrans\task\speech2text.py", line 126, in recogn

File "videotrans\recognition\__init__.py", line 190, in run

File "videotrans\recognition\_base.py", line 94, in run

File "videotrans\recognition\_whisper.py", line 34, in _exec

File "videotrans\recognition\_whisper.py", line 77, in _openai

File "videotrans\configure\base.py", line 253, in _new_process

videotrans.configure.excepts.VideoTransError: 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_fun.py", line 102, in openai_whisper
File "whisper\transcribe.py", line 295, in transcribe
File "whisper\transcribe.py", line 201, in decode_with_fallback
File "torch\utils\_contextlib.py", line 116, in decorate_context

return func(*args, **kwargs)

File "whisper\decoding.py", line 824, in decode
File "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 "torch\distributions\categorical.py", line 73, in init

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

File "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')
TaskCfgSTT(uuid='8b280b2ec4', name='E:/DownLoad/DCL/Lucia Gomez - Dick In Ass For the FIRST Time Son causes PAINAL.mp4', dirname='E:/DownLoad/DCL', noextname='Lucia Gomez - Dick In Ass For the FIRST Time Son causes PAINAL', basename='Lucia Gomez - Dick In Ass For the FIRST Time Son causes PAINAL.mp4', ext='mp4', target_dir='D:/win-pyvideotrans-v4.01-0602/output/recogn', cache_folder='D:/win-pyvideotrans-v4.01-0602/tmp/1148/8b280b2ec4', is_cuda=True, source_language=None, source_language_code=None, source_sub=None, source_wav=None, source_wav_output=None, target_language=None, target_language_code=None, target_sub='D:/win-pyvideotrans-v4.01-0602/output/recogn/Lucia Gomez - Dick In Ass For the FIRST Time Son causes PAINAL.srt', target_wav=None, target_wav_output=None, detect_language='auto', recogn_type=1, model_name='large-v3-turbo', shibie_audio='D:/win-pyvideotrans-v4.01-0602/tmp/1148/8b280b2ec4/Lucia Gomez - Dick In Ass For the FIRST Time Son causes PAINAL-1781522778.5164537.wav', remove_noise=False, enable_diariz=False, nums_diariz=0, rephrase=0, fix_punc=False)


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

1 Replies

核心原因:openai-whisper 在 GPU 推理过程中产生了 NaN 值,通常是显存不足或 CUDA 运算不稳定导致,尤其当使用 large-v3-turbo 且文件路径较长或复杂时容易触发。

解决办法(按推荐顺序尝试):

  1. 降低模型尺寸:在语音识别渠道中选择 openai-whisper(本地) 然后更换为更小的模型,例如 smallbase,避免显存溢出导致 NaN。
  2. 关闭 CUDA 加速:取消勾选主界面 CUDA加速,强制使用 CPU 运行(速度会慢,但可验证是否为 GPU 问题)。
  3. 清理并重下模型文件:删除 models/ 目录下对应的 openai-whisper 模型文件夹,重新运行软件让其自动下载,避免模型文件损坏。
  4. 调整计算数据类型:进入 菜单 -> 工具 -> 高级选项 -> 语音识别参数,将 计算数据类型 改为 float16int8,降低显存压力。
  5. 简化视频路径:将视频移动到盘符根目录(如 D:/video.mp4),并确保路径中无中文、空格及特殊符号。

请查阅相关文档:

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: ko-fi.com/jianchang512

Related resource