#6693 翻译字幕阶段出错 [兼容AI/本地模型] 内容太长超出最大允许Token,请减小内容或增大max_token,或者降低每次发送字幕行数Could not parse response content as the length limit

119.123.**9 Posted at: 1 day ago

翻译字幕阶段出错 [兼容AI/本地模型] 内容太长超出最大允许Token,请减小内容或增大max_token,或者降低每次发送字幕行数
Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=8192, prompt_tokens=3953, total_tokens=12145, completion_tokens_details=None, prompt_tokens_details=None)
Traceback (most recent call last):

File "videotrans\translator\_base.py", line 68, in run

File "videotrans\translator\_base.py", line 107, in _run_text

File "tenacity\__init__.py", line 338, in wrapped_f

File "tenacity\__init__.py", line 477, in call

File "tenacity\__init__.py", line 378, in iter

File "tenacity\__init__.py", line 421, in exc_check

tenacity.RetryError: RetryError[]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

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

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

File "videotrans\task\_stage_translate.py", line 31, in trans

File "videotrans\translator\_runner.py", line 68, in run

File "videotrans\translator\_base.py", line 74, in run

File "tenacity\__init__.py", line 480, in call

File "videotrans\translator\_openaicompat.py", line 99, in _item_task

openai.LengthFinishReasonError: Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=8192, prompt_tokens=3953, total_tokens=12145, completion_tokens_details=None, prompt_tokens_details=None)
cfg=[TaskCfgVTT]当前工作模式: 转录并翻译字幕
原始输入文件名: F:/哔哩哔哩/【原神 录播生肉】屠鸟哥 7.0魔神任务 第一天 2026-8-13/【原神 录播生肉】屠鸟哥 7.0魔神任务 第一天 2026-8-13.mp4,
输出结果保存到文件夹: F:/哔哩哔哩/【原神 录播生肉】屠鸟哥 7.0魔神任务 第一天 2026-8-13/_video_out/【原神 录播生肉】屠鸟哥 7.0魔神任务 第一天 2026-8-13-mp4,
临时文件夹: K:/win-pyvideotrans-v4.09/tmp/31268/efe6b6c38b
未选 清理已存在
已启用CUDA加速
未选 降噪
语音识别:Qwen-ASR(内置), 1.7B, 发音语言: 英语, 断句方式:默认断句
翻译渠道:兼容AI/本地模型,原始语言:英语,目标语言:简体中文, 未选 发送完整字幕
已选 将生成的字幕复制到视频目录下
输出字幕格式: 单字幕


=
system:Windows-10-10.0.26200-SP0
version:v4.09
frozen:True
language:zh
root_dir:K:/win-pyvideotrans-v4.09

1 Replies

#1 DeepSeek reply at 1 day ago

这是本地AI大模型输出长度达到 max_tokens 上限(8192)后被迫截断导致的报错。你的日志显示 completion_tokens=8192,说明模型每次生成的文本已触顶,无法完整返回翻译结果。

按以下步骤解决:

  1. 打开 菜单 → 工具 → 高级选项 → 字幕翻译调整,将 AI翻译渠道每批字幕行数 调低,建议改为 1,再重新执行。
  2. 打开 菜单 → 翻译设置 → 兼容AI/本地模型,将对应模型的 max_token(最大输出Token)调大,例如设为 16384 或更高,让单次输出有更多空间。
  3. 若调整后仍报错,说明所选本地模型本身输出能力有限,请更换支持更长输出的模型,或进一步减小每批字幕行数。
  4. 改完设置后,建议删除 tmp/translate_cache/ 下的缓存,或在主界面勾选 清理已生成,避免旧缓存干扰。

请查阅相关文档:

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