#5754 Subprocess Error: Backend should be defined in the BACKENDS_MAPPING. Offending backend: keras_nlpTraceback (most recent

150.107* Posted at: 4 days ago

Subprocess Error: Backend should be defined in the BACKENDS_MAPPING. Offending backend: keras_nlp
Traceback (most recent call last):
File "videotrans\task\only_one.py", line 46, in run
File "videotrans\task\_stage_recogn.py", line 62, in recogn
File "videotrans\recognition\__init__.py", line 205, in run
File "videotrans\recognition\_base.py", line 91, in run
File "videotrans\recognition\_whisper.py", line 38, in _exec
File "videotrans\recognition\_whisper.py", line 124, in _faster
File "videotrans\configure\base.py", line 272, in _new_process
videotrans.configure.excepts.VideoTransError: Subprocess Error: Backend should be defined in the BACKENDS_MAPPING. Offending backend: keras_nlp

cfg=[TaskCfgVTT]当前工作模式: 翻译视频或音频 单视频模式
原始输入文件名: C:/Users/MSI/Downloads/best_accounting_software_for_freelancers.mp3,
输出结果保存到文件夹: C:/Users/MSI/Downloads/_video_out/best_accounting_software_for_freelancers-mp3,
临时文件夹: D:/PyVideoTrans/tmp/4944/5c560957c2
已选 清理已存在
已选 启用CUDA加速
未选 降噪
ASR Channel:faster-whisper(LocalBuilt-in), model_name: large-v3-turbo, 发音语言: English, 断句方式:默认断句
Trans Channel:Microsoft (Free),原始语言:English,目标语言:Spanish, 已选 Send SRT
Dubb Channel:Qwen3-TTS(LocalBuilt-in), 角色:clone, 配音语言:Spanish, 未选 二次语音识别
音量:+0%, 语速:+0%, 未选 音频加速, 未选 视频慢速
未选 移除字幕间空隙, 已选 强制对齐字幕和声音
字幕: Embed Hard Subs
代理地址:


=
system:Windows-10-10.0.26200-SP0
version:v4.05
frozen:True
language:en
root_dir:D:/PyVideoTrans

5 Replies

<RSULT>
The error "Backend should be defined in the BACKENDS_MAPPING. Offending backend: keras_nlp" indicates a conflict or corruption in the deep learning model environment, likely related to a dependency like keras or tensorflow being incorrectly loaded by the subprocess running faster-whisper. This is not a typical faster-whisper error; it suggests that some model file or bundled library is misconfigured.

Troubleshooting steps:

  1. Redownload the model – The large-v3-turbo model file may be corrupted. Delete the model folder at D:/PyVideoTrans/models/models--mobiuslabsgmbh--faster-whisper-large-v3-turbo/ and re-run. The software will download it again automatically.
  2. Try a different model – Switch to large-v3 or medium in the ASR channel settings. This avoids the turbo variant which might have an incompatible format.
  3. Disable CUDA temporarily – Uncheck "Enable CUDA acceleration" and run again. If it works, the issue may be related to GPU driver/CUDA compatibility. Update your NVIDIA driver and ensure CUDA 12.8+ and cuDNN 9.11+ are correctly installed.
  4. Clean the tmp/ cache – Clear the D:/PyVideoTrans/tmp/ folder (except the folder itself) to remove any stale temprary files from previous runs.
  5. If none above works – Re-download the full 2.6GB package from the official site and re-extract it, then apply the latest patch. Do not use a previously corrupted installation.
  6. Check logs – Provide the last ~30 lines from D:/PyVideoTrans/logs/YYYYMMDD.log for further analysis if the problem persists.

Reference documentation:


Application started at 2026-07-10 17:29:39

1783683879:Loading resources...
1783683879:Loading main window...
1783683879:Initializing UI...
1783683880:SetupUI end...
1783683880:import recognition ...
1783683880:import tts ...
1783683880:import translate ...
1783683880:Get cache ...
1783683880:Set default value ...
1783683880:import voices list ...
1783683880:Set tts voice ...
[DEBUG] 上次缓存的角色:No,字幕嵌入类型:1,发音语言:en,目标语言:zh-cn,目标语言代码:None,模型:large-v3-turbo,TTS渠道[0]
1783683880:show main window ...
1783683880:Bind signal...
1783683880:set cursor...
1783683880:preload TTS win...
1783683881:preload STT win...
1783683881:preload translate srt win...
1783683881:end
[DEBUG] 平台: Windows。正在按优先级检测最佳的 'h264' 编码器: ['nvenc', 'qsv', 'amf']
[DEBUG] 正在测试编码器是否可用: h264_nvenc...
[DEBUG] 可用 Nvidia 显卡数: 1
[DEBUG] 找到 1 个 Nvidia GPUs, 耗时: 16s

[DEBUG] start 9 jobs
[WARNING] 硬件编码器
......
D:/PyVideoTrans/tmp/18076/5c560957c2
已选 清理已存在
未选 启用CUDA加速
未选 降噪
ASR Channel:faster-whisper(LocalBuilt-in), model_name: medium, 发音语言: English, 断句方式:默认断句
Trans Channel:Microsoft (Free),原始语言:English,目标语言:Spanish, 已选 Send SRT
Dubb Channel:Qwen3-TTS(LocalBuilt-in), 角色:clone, 配音语言:Spanish, 未选 二次语音识别
音量:+0%, 语速:+0%, 未选 音频加速, 未选 视频慢速
未选 移除字幕间空隙, 已选 强制对齐字幕和声音
字幕: Embed Hard Subs
代理地址:
[DEBUG] The file info after process:result={'video_fps': 30, 'r_frame_rate': 30, 'video_codec_name': '', 'audio_codec_name': 'mp3', 'width': 0, 'height': 0, 'time': 371064, 'streams_len': 1, 'streams_audio': 1, 'video_streams': 0, 'color': 'yuv420p'}

[DEBUG] app_cfg.proxy=None
[DEBUG] 可以使用 huggingface.co
Returning existing local_dir D:\PyVideoTrans\models\models--Systran--faster-whisper-medium as remote repo cannot be accessed in snapshot_download (None).
[DEBUG] [新进程任务 开始:title='STT use medium']
[DEBUG] 新进程任务 参数:kwargs={'detect_language': 'en', 'model_name': 'medium', 'logs_file': 'D:/PyVideoTrans/tmp/18076/5c560957c2/faster-en-1783689364.141082.log', 'is_cuda': False, 'no_speech_threshold': 0.6, 'condition_on_previous_text': False, 'speech_timestamps': None, 'audio_file': 'D:/PyVideoTrans/tmp/18076/5c560957c2/en.wav', 'local_dir': 'D:/PyVideoTrans/models/models--Systran--faster-whisper-medium', 'compute_type': 'default', 'jianfan': False, 'audio_duration': 370999, 'hotwords': '', 'prompt': '', 'beam_size': 5, 'best_of': 5, 'temperature': '', 'repetition_penalty': 1.0, 'compression_ratio_threshold': 2.4, 'max_speech_ms': 5000, 'subtitle_srt': 'D:/PyVideoTrans/tmp/faster-20260710-19_01_04.srt'}
[DEBUG] CPU进程池:max_workers=2
[ERROR] CPU进程池回调异常: Backend should be defined in the BACKENDS_MAPPING. Offending backend: keras_nlp
[DEBUG] [新进程任务 title='STT use medium'] 已返回
[ERROR] STT use medium,Subprocess Error: Backend should be defined in the BACKENDS_MAPPING. Offending backend: keras_nlp
Traceback (most recent call last):
File "videotrans\configure\base.py", line 272, in _new_process
videotrans.configure.excepts.VideoTransError: Subprocess Error: Backend should be defined in the BACKENDS_MAPPING. Offending backend: keras_nlp
[DEBUG] [新进程任务 结束:title='STT use medium'],耗时4.123657464981079s
[ERROR] 单视频模式翻译失败Subprocess Error: Backend should be defined in the BACKENDS_MAPPING. Offending backend: keras_nlp
Traceback (most recent call last):
File "videotrans\task\only_one.py", line 46, in run
File "videotrans\task\_stage_recogn.py", line 62, in recogn
File "videotrans\recognition\__init__.py", line 205, in run
File "videotrans\recognition\_base.py", line 91, in run
File "videotrans\recognition\_whisper.py", line 38, in _exec
File "videotrans\recognition\_whisper.py", line 124, in _faster
File "videotrans\configure\base.py", line 272, in _new_process
videotrans.configure.excepts.VideoTransError: Subprocess Error: Backend should be defined in the BACKENDS_MAPPING. Offending backend: keras_nlp

这个错误“Backend should be defined in the BACKENDS_MAPPING. Offending backend: keras_nlp”是由于软件依赖的深度学习库(如 Keras/TensorFlow)环境损坏或版本冲突导致的。即使更换模型或关闭 CUDA 也无法绕过,因为 faster-whisper 的子进程在加载模型时遇到了底层库异常。

解决方案:

  1. 重新下载完整版压缩包
    前往官网下载 2.6GB+ 的完整绿色主程序(非补丁包),解压到全英文目录(如 D:\pyVideoTrans),不要覆盖旧文件。
    如果之前已下载过补丁包,需要先删除整个旧目录。
  2. 检查是否存在文件被安全软件隔离
    关闭 Windows Defender 实时代护、360/火绒等杀毒软件,或将 D:\pyVideoTrans 整个文件夹加入白名单,然后重新解压。
  3. 清理临时缓存
    删除 tmp/ 文件夹(D:\PyVideoTrans\tmp\)中的所有子文件夹和文件。
  4. 尝试其他 ASR 渠道
    如果仍无法解决,可暂时切换到其他内置 ASR 渠道:

    • openai-whisper(LocalBuilt-in) + 模型 large-v3(需先下载模型)
    • Qwen-ASR(LocalBuilt-in)(中文场景)

    这些渠道的底层依赖不同,可以绕开 keras_nlp 问题。

  5. 提供日志深入排查
    若以上步骤无效,请提供 D:\PyVideoTrans\logs\ 目录中最新日志文件的最后约 50 行内容,以及软件版本号(左上角 v4.05),以便进一步分析。


Application started at 2026-07-10 19:34:16

1783691356:Loading resources...
1783691356:Loading main window...
1783691356:Initializing UI...
1783691356:SetupUI end...
1783691356:import recognition ...
1783691356:import tts ...
1783691356:import translate ...
1783691356:Get cache ...
1783691356:Set default value ...
1783691356:import voices list ...
1783691356:Set tts voice ...
[DEBUG] 上次缓存的角色:No,字幕嵌入类型:1,发音语言:en,目标语言:zh-cn,目标语言代码:None,模型:large-v3-turbo,TTS渠道[0]
1783691356:show main window ...
1783691356:Bind signal...
1783691356:set cursor...
1783691356:preload TTS win...
1783691357:preload STT win...
1783691357:preload translate srt win...
1783691357:end
[DEBUG] 平台: Windows。正在按优先级检测最佳的 'h264' 编码器: ['nvenc', 'qsv', 'amf']
[DEBUG] 正在测试编码器是否可用: h264_nvenc...
[DEBUG] 可用 Nvidia 显卡数: 1
[DEBUG] 找到 1 个 Nvidia GPUs, 耗时: 2s

[DEBUG] start 9 jobs
[WARNING] 硬件编码器 '
......
Free),原始语言:English,目标语言:Spanish, 已选 Send SRT
未选 配音角色,不进行配音
字幕: Embed Hard Subs
代理地址:
[DEBUG] The file info after process:result={'video_fps': 30, 'r_frame_rate': 30, 'video_codec_name': '', 'audio_codec_name': 'mp3', 'width': 0, 'height': 0, 'time': 371064, 'streams_len': 1, 'streams_audio': 1, 'video_streams': 0, 'color': 'yuv420p'}

[DEBUG] app_cfg.proxy=None
[DEBUG] 可以使用 huggingface.co
[DEBUG] app_cfg.proxy=None
[DEBUG] 可以使用 huggingface.co
[DEBUG] 获取到下载锁,开始从 hf下载 Systran/faster-whisper-medium
huggingface_hub\utils\_validators.py:205: UserWarning: The local_dir_use_symlinks argument is deprecated and ignored in snapshot_download. Downloading to a local directory does not use symlinks anymore.
warnings.warn(
Warning: You are sending unauthenticated requests to the HF Hub. Please set a HF_TOKEN to enable higher rate limits and faster downloads.
[DEBUG] [新进程任务 开始:title='STT use medium']
[DEBUG] 新进程任务 参数:kwargs={'detect_language': 'en', 'model_name': 'medium', 'logs_file': 'D:/PyVideoTrans/tmp/20560/5c560957c2/faster-en-1783691558.4475675.log', 'is_cuda': True, 'no_speech_threshold': 0.6, 'condition_on_previous_text': False, 'speech_timestamps': None, 'audio_file': 'D:/PyVideoTrans/tmp/20560/5c560957c2/en.wav', 'local_dir': 'D:/PyVideoTrans/models/models--Systran--faster-whisper-medium', 'compute_type': 'default', 'jianfan': False, 'audio_duration': 370999, 'hotwords': '', 'prompt': '', 'beam_size': 5, 'best_of': 5, 'temperature': '', 'repetition_penalty': 1.0, 'compression_ratio_threshold': 2.4, 'max_speech_ms': 5000, 'subtitle_srt': 'D:/PyVideoTrans/tmp/faster-20260710-19_37_38.srt', 'device_index': 0}
[DEBUG] GPU进程池:max_workers=1
[ERROR] GPU进程池回调异常: Backend should be defined in the BACKENDS_MAPPING. Offending backend: tf
[DEBUG] [新进程任务 title='STT use medium'] 已返回
[ERROR] STT use medium,Subprocess Error: Backend should be defined in the BACKENDS_MAPPING. Offending backend: tf
Traceback (most recent call last):
File "videotrans\configure\base.py", line 272, in _new_process
videotrans.configure.excepts.VideoTransError: Subprocess Error: Backend should be defined in the BACKENDS_MAPPING. Offending backend: tf
[DEBUG] [新进程任务 结束:title='STT use medium'],耗时4.060285568237305s
[ERROR] 单视频模式翻译失败Subprocess Error: Backend should be defined in the BACKENDS_MAPPING. Offending backend: tf
Traceback (most recent call last):
File "videotrans\task\only_one.py", line 46, in run
File "videotrans\task\_stage_recogn.py", line 62, in recogn
File "videotrans\recognition\__init__.py", line 205, in run
File "videotrans\recognition\_base.py", line 91, in run
File "videotrans\recognition\_whisper.py", line 38, in _exec
File "videotrans\recognition\_whisper.py", line 124, in _faster
File "videotrans\configure\base.py", line 272, in _new_process
videotrans.configure.excepts.VideoTransError: Subprocess Error: Backend should be defined in the BACKENDS_MAPPING. Offending backend: tf

错误根源与上次一致:faster-whisper 底层依赖的 TensorFlow/Keras 环境异常,报错 Backend should be defined in the BACKENDS_MAPPING. Offending backend: tf。这表明模型加载时遇到了库的版本冲突或文件损坏。即使重新下载了完整包,问题依然存在。

请按以下步骤彻底解决:

  1. 删除损坏的模型文件
    进入 D:\PyVideoTrans\models\ 目录,删除整个文件夹 models--Systran--faster-whisper-medium(包括所有子文件和缓存)。
    下次运行软件时会自动重新下载,确保得到完整的模型。
  2. 临时切换 ASR 渠道(绕过 TensorFlow)
    在主界面将 ASR Channel 从 faster-whisper(本地内置) 改为 openai-whisper(本地内置),模型仍选 medium
    openai-whisper 使用 PyTorch 后端,不会触发 TensorFlow 的冲突,可立即解决此报错。
  3. 检查杀毒软件隔离
    关闭 Windows Defender 实时保护、360/火绒等软件,然后重新解压完整版(v4.05)到 D:\PyVideoTrans。解压后不要覆盖任何旧文件。某些杀毒软件会误删或隔离 TensorFlow 的 .pyd.dll 文件,导致加载失败。
  4. 清理临时缓存
    删除 D:\PyVideoTrans\tmp\ 下的所有子文件夹和文件(保留空目录即可)。
  5. 如果以上均无效
    请提供完整的日志文件(D:\PyVideoTrans\logs\ 中最新日期的 .log 文件内容),并告知:

    • 你的 Windows 版本(Win10/Win11)
    • 显卡型号及 NVIDIA 驱动版本
    • 是否同时安装了其他 Python 或 AI 工具(如 Anaconda、TensorFlow 独立环境)

参考文档:

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