#8927 语音识别阶段出错[openai-whisper(内置)] Attempting to deserialize object on CUDA device 1 but torch.cuda.device_count() is 1. Pleas

52.77**5 Posted at: 9 hours ago

语音识别阶段出错[openai-whisper(内置)] Attempting to deserialize object on CUDA device 1 but torch.cuda.device_count() is 1. Please use torch.load with map_location to map your storages to an existing device.:Traceback (most recent call last):
File "videotrans\process\stt_openai.py", line 55, in openai_whisper
File "whisper\__init__.py", line 151, in load_model
File "D:\ai\6videotrans\_internal\torch\serialization.py", line 1516, in load

return _load(

File "D:\ai\6videotrans\_internal\torch\serialization.py", line 2114, in _load

result = unpickler.load()

File "D:\ai\6videotrans\_internal\torch\_weights_only_unpickler.py", line 532, in load

self.append(self.persistent_load(pid))

File "D:\ai\6videotrans\_internal\torch\serialization.py", line 2078, in persistent_load

typed_storage = load_tensor(

File "D:\ai\6videotrans\_internal\torch\serialization.py", line 2044, in load_tensor

wrap_storage = restore_location(storage, location)

File "D:\ai\6videotrans\_internal\torch\serialization.py", line 1854, in restore_location

return default_restore_location(storage, map_location)

File "D:\ai\6videotrans\_internal\torch\serialization.py", line 698, in default_restore_location

result = fn(storage, location)

File "D:\ai\6videotrans\_internal\torch\serialization.py", line 636, in _deserialize

device = _validate_device(location, backend_name)

File "D:\ai\6videotrans\_internal\torch\serialization.py", line 615, in _validate_device

raise RuntimeError(

RuntimeError: Attempting to deserialize object on CUDA device 1 but torch.cuda.device_count() is 1. Please use torch.load with map_location to map your storages to an existing device.

Traceback (most recent call last):

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

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

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

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

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

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

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

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

videotrans.configure.excepts.VideoTransError: Attempting to deserialize object on CUDA device 1 but torch.cuda.device_count() is 1. Please use torch.load with map_location to map your storages to an existing device.:Traceback (most recent call last):
File "videotrans\process\stt_openai.py", line 55, in openai_whisper
File "whisper\__init__.py", line 151, in load_model
File "D:\ai\6videotrans\_internal\torch\serialization.py", line 1516, in load

return _load(

File "D:\ai\6videotrans\_internal\torch\serialization.py", line 2114, in _load

result = unpickler.load()

File "D:\ai\6videotrans\_internal\torch\_weights_only_unpickler.py", line 532, in load

self.append(self.persistent_load(pid))

File "D:\ai\6videotrans\_internal\torch\serialization.py", line 2078, in persistent_load

typed_storage = load_tensor(

File "D:\ai\6videotrans\_internal\torch\serialization.py", line 2044, in load_tensor

wrap_storage = restore_location(storage, location)

File "D:\ai\6videotrans\_internal\torch\serialization.py", line 1854, in restore_location

return default_restore_location(storage, map_location)

File "D:\ai\6videotrans\_internal\torch\serialization.py", line 698, in default_restore_location

result = fn(storage, location)

File "D:\ai\6videotrans\_internal\torch\serialization.py", line 636, in _deserialize

device = _validate_device(location, backend_name)

File "D:\ai\6videotrans\_internal\torch\serialization.py", line 615, in _validate_device

raise RuntimeError(

RuntimeError: Attempting to deserialize object on CUDA device 1 but torch.cuda.device_count() is 1. Please use torch.load with map_location to map your storages to an existing device.
trk=语音转录
self.cfg.name='E:/新建文件夹/新建文件夹/DKTM-024.mp4',
self.cfg.target_dir='E:/新建文件夹/新建文件夹',
self.cfg.cache_folder='D:/ai/6videotrans/tmp/17860/b8ec4d7910'
self.cfg.is_cuda=True
语音识别:openai-whisper(内置), large-v3, 发音语言: ja
最长语音持续(秒): 10s
最短语音持续(毫秒): 1200ms
静音分割持续毫秒: 1000ms
语音阈值: 0.5
选择VAD: silero
输出格式: srt
中日韩字幕单行字符数:15, 其他语言字幕单行字符数:40
self.cfg=TaskCfgSTT(uuid='b8ec4d7910', name='E:/新建文件夹/新建文件夹/DKTM-024.mp4', dirname='E:/新建文件夹/新建文件夹', noextname='DKTM-024', basename='DKTM-024.mp4', ext='mp4', target_dir='E:/新建文件夹/新建文件夹', cache_folder='D:/ai/6videotrans/tmp/17860/b8ec4d7910', is_cuda=True, source_language='', source_language_code='', source_sub=None, source_wav=None, source_wav_output=None, target_language='', target_language_code='', target_sub='E:/新建文件夹/新建文件夹/DKTM-024.srt', target_wav=None, target_wav_output=None, detect_language='ja', recogn_type=1, model_name='large-v3', shibie_audio='D:/ai/6videotrans/tmp/17860/b8ec4d7910/DKTM-024-1795475720.4759088.wav', remove_noise=False, enable_diariz=False, nums_diariz=0, rephrase=False, fix_punc=0)


=
system:Windows-10-10.0.26300-SP0
version:v4.19
frozen:True
language:zh_CN
root_dir:D:/ai/6videotrans

1 Replies

#1 DeepSeek reply at 9 hours ago

核心原因:软件在加载 openai-whisper 模型时,把设备指定成了 cuda:1(第二块显卡),但当前环境 torch.cuda.device_count() 只有 1(即只有 cuda:0),反序列化时找不到对应设备,因此崩溃。这通常源于 GPU 设备分配设置错误,或核显与独显混合环境下显卡枚举不一致。

排查与解决(按顺序尝试):

  1. 检查设备强制指定
    打开 菜单 → 工具/选项 → 高级选项 → 通用设置,将 强制指定重型任务运行设备 恢复为默认或清空(不要手动填写 cuda:1),把 GPU同时任务数[重启生效] 设为 1,保存后 完全退出并重启软件。
  2. 确认显卡枚举正常
    若设备只有一块 N 卡(或笔记本核显与独显),重启后再次观察是否仍提示 cuda:1。可在软件启动后先跑一个小文件测试,避免使用大批量任务。
  3. 临时绕过验证
    取消主界面 CUDA加速 复选框(改用 CPU 运行),或用 faster-whisper(内置) 渠道替代 openai-whisper(内置) —— faster-whisper 是官方默认推荐渠道,对多卡与设备枚举的兼容性更好,且你当前用的 large-v3 模型在 faster-whisper 下同样可用。
  4. 更新显卡驱动
    CUDA 12.8 对驱动版本有底线要求,请到英伟达官网更新到最新驱动后再试。
  5. 若完成上述步骤,且确认本机确实只有一块显卡,但软件仍分配到 cuda:1,说明是设备枚举异常,需提供 D:/ai/6videotrans/logs/ 下最新日志文件底部约 30 行内容以便进一步分析。

请查阅相关文档:

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