#8812 翻译字幕阶段出错 [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=32000, prompt_tokens=20229, total_tokens=52229, completion_tokens_details=None, prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=20224), prompt_cache_hit_tokens=20224, prompt_cache_miss_tokens=5)
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\translate_srt.py", line 51, 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=32000, prompt_tokens=20229, total_tokens=52229, completion_tokens_details=None, prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=20224), prompt_cache_hit_tokens=20224, prompt_cache_miss_tokens=5)
[TranslateSrt]翻译字幕: OutputFormat=单语字幕
[TaskCfgSTS]
原始输入文件名: D:/chzzk/_video_out/말스터즈 구세종 - Romatic - Part 2 (00-45-00 to 01-30-01)-mp4/ko.srt,
输出结果保存到文件夹: D:/chzzk/_video_out/translate
翻译渠道:DeepSeek,原始语言:ko,目标语言:zh-cn, 已选 发送完整字幕
代理地址: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 的字幕过多(输入 20229 tokens、输出已顶到 32000 tokens 上限被截断),模型还没输出完就被长度限制强行中止,因此解析失败;或原始字幕中存在大段重复文本,导致模型陷入死循环直到耗尽 token。

解决步骤:

  1. 打开 菜单 → 工具/选项 → 高级选项 → 字幕翻译,将 AI翻译渠道每批字幕行数 改为 10 或 20(当前值过大是直接诱因,改小后重新翻译)。
  2. 若第 1 步后仍报错,请打开报错的 ko.srt,检查是否有个别字幕行包含大量重复文字(如连续的 “no no no…” 或长串重复短语),手动删除这些重复内容后再翻译。
  3. 若 DeepSeek 设置面板中有 思考深度 / Thinking 选项,请关闭思考模式(选 none 或取消勾选),思考 token 同样占用输出上限。
  4. 也可临时取消选中主界面的 发送完整字幕,改为逐行文本翻译模式,输入体积会大幅下降。
  5. 重新执行前请勾选 清理已生成(或删除 tmp/translate_cache/ 缓存),避免复用被截断的译文缓存。

补充说明:max_tokens 并非越大越好,它只是把中止阈值抬高,不能解决“输出停不下来”的问题,根治手段仍是缩小每批字幕行数。

请查阅相关文档:

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