#6094 Expected parameter logits (Tensor of shape (1, 51866)) of distribution Categorical(logits: torch.Size([1, 51866])) to sa

240e:341* Posted at: 15 hours ago

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_sh

......
, 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')

cfg=[TaskCfgVTT]当前工作模式: 翻译视频或音频 单视频模式
原始输入文件名: C:/Users/11924/Videos/【中字合集】艾尔登法环 官方发售宣传片合集_P3_故事宣傳影片.mp4,
输出结果保存到文件夹: C:/Users/11924/Videos/_video_out/【中字合集】艾尔登法环 官方发售宣传片合集_P3_故事宣傳影片-mp4,
临时文件夹: F:/win-pyvideotrans-v4.03-0626/tmp/15520/e7148bf3fe
已选 清理已存在
已选 启用CUDA加速
未选 降噪
语音识别:openai-whisper(本地内置), model_name: large-v3, 发音语言: 繁体中文, 断句方式:默认断句
翻译渠道:Google(免费),原始语言:繁体中文,目标语言:简体中文, 已选 发送完整字幕
配音渠道:GPT-SoVITS(本地API), 角色:拉妮.wav , 配音语言:简体中文, 未选 二次语音识别
音量:+0%, 语速:+0%, 已选 音频加速, 未选 视频慢速
字幕: 嵌入硬字幕
代理地址:


=
system:Windows-10-10.0.26200-SP0
version:v4.03
frozen:True
language:zh
root_dir:F:/win-pyvideotrans-v4.03-0626

1 Replies

这个报错是由于显存不足或模型/音频数据异常导致 openai-whisper 在推理时产生了 NaN 值(logits 全部为 NaN)。

请按以下步骤依次排查:

  1. 降低模型尺寸:当前使用 large-v3 需要至少 10GB 以上显存。请切换到 mediumsmall 模型,或改用 faster-whisper 渠道的 large-v3(更省显存)。
  2. 关闭 GPU 加速测试:取消勾选 CUDA 加速,改用 CPU 运行一次(速度慢但可确认是否为显存问题)。若 CPU 正常,则属于 GPU 显存不足或 CUDA 驱动问题。
  3. 检查 CUDA 与 cuDNN 版本:确保已安装 CUDA 12.8+ 和 cuDNN 9.11+。打开 CMD 输入 nvcc -V 验证。
  4. 重置计算数据类型:进入 菜单 → 工具 → 高级选项 → 语音识别参数,将 计算数据类型 设为 int8(最省显存),beam_sizebest_of 设为 1,关闭 启用上下文感知
  5. 检查音频文件:该视频文件名包含中文和特殊字符(【】),可能引起 FFmpeg 解析异常。建议将视频文件名改为纯英文数字(如 elden_ring.mp4),并放在磁盘根目录(如 D:/)后再试。

如果以上步骤仍报错,请提供 logs/ 目录下最新日志文件中的后 30 行完整堆栈信息。

请查阅相关文档:

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

Dondate via PayPal

Related resource