#8811 翻译字幕阶段出错 [DeepSeek] Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens

109.122**0 Posted at: 1 day ago

翻译字幕阶段出错 [DeepSeek] Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=16384, prompt_tokens=5470, total_tokens=21854, completion_tokens_details=None, prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=5376), prompt_cache_hit_tokens=5376, prompt_cache_miss_tokens=94)
Traceback (most recent call last):

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

File "videotrans\translator\_base.py", line 155, in _run_srt

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 75, in run

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

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

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

openai.LengthFinishReasonError: Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=16384, prompt_tokens=5470, total_tokens=21854, completion_tokens_details=None, prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=5376), prompt_cache_hit_tokens=5376, prompt_cache_miss_tokens=94)

self.cfg=[TaskCfgVTT]当前工作模式: 转录并翻译字幕
原始输入文件名: D:/chzzk/말스터즈 구세종 - Romatic - Part 2 (00-45-00 to 01-30-01).mp4,
输出结果保存到文件夹: D:/chzzk/_video_out/말스터즈 구세종 - Romatic - Part 2 (00-45-00 to 01-30-01)-mp4,
临时文件夹: D:/wrok/win-pyvideotrans-v4.13–1/tmp/5116/eb9247c896
已选 清理已存在
已启用CUDA加速
未选 降噪
语音识别:faster-whisper(内置), large-v3-turbo, 发音语言: 韩语, 断句方式:LLM重新断句
翻译渠道:DeepSeek,原始语言:韩语,目标语言:简体中文, 已选 发送完整字幕
输出字幕格式: 单字幕
代理地址:http://127.0.0.1:10090


=
system:Windows-10-10.0.26200-SP0
version:v4.13
frozen:True
language:zh_CN
root_dir:D:/wrok/win-pyvideotrans-v4.13–1

1 Replies

#1 DeepSeek reply at 1 day ago

核心原因:单次提交给 DeepSeek 的字幕量过大,模型输出达到 16384 token 上限被强行截断(completion_tokens=16384 已顶到 max_tokens),返回内容不完整,解析必然失败。次要原因可能是某行原始字幕含大量重复文字(如连续的 "no,no,no..."),导致模型陷入死循环直到耗尽 token。

解决步骤(按优先级):

  1. 减小每批字幕行数(最有效)
    菜单 → 工具/选项 → 高级选项 → 字幕翻译 → 将 AI翻译渠道每批字幕行数 从当前值改为 10 或 20,保存后重试(务必勾选 清理已生成)。
  2. 关闭 DeepSeek 思考模式
    菜单 → 翻译设置 → DeepSeek,将 思考深度 设为 none。思考模式会额外消耗大量 token,极易触顶截断。(若设为 none 后报"模型不支持关闭思考",改回 default)
  3. 检查原始字幕中的重复内容
    打开输出目录 D:/chzzk/_video_out/말스터즈 구세종 - Romatic - Part 2 (00-45-00 to 01-30-01)-mp4 内生成的韩语 srt 字幕,查找是否存在同一行内大段重复单词/短语,如有请手动删除重复部分后再翻译。
  4. 调大 max tokens
    在 DeepSeek 设置界面将最大输出 token 调大(如 8192→32000,视所用模型上限),但此项只是缓解,不能替代第 1 步。

补充说明:您同时选中了 发送完整字幕 与 LLM重新断句,后者可能产生超长字幕行,也会加剧该问题。如仍有报错,可临时取消 发送完整字幕,改用按行翻译模式。

请查阅相关文档:

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