#7024 内容太长超出最大允许Token,请减小内容或增大max_token,或者降低每次发送字幕行数Could not parse response content as the length limit was reached - Complet

240e**dfec Posted at: 1 hour ago

内容太长超出最大允许Token,请减小内容或增大max_token,或者降低每次发送字幕行数
Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=65536, prompt_tokens=840, total_tokens=66376, completion_tokens_details=None, prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=640), prompt_cache_hit_tokens=640, prompt_cache_miss_tokens=200)
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\only_one.py", line 89, in run
File "videotrans\task\_stage_translate.py", line 31, in trans
File "videotrans\translator\_runner.py", line 67, 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 105, in _item_task
openai.LengthFinishReasonError: Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=65536, prompt_tokens=840, total_tokens=66376, completion_tokens_details=None, prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=640), prompt_cache_hit_tokens=640, prompt_cache_miss_tokens=200)

cfg=[TaskCfgVTT]当前工作模式: 翻译视频 单视频模式
原始输入文件名: E:/BC/jasna/JKS-155_restored.mp4,
输出结果保存到文件夹: E:/BC/jasna/_video_out/JKS-155_restored-mp4,
临时文件夹: D:/CY/SP/win-pyvideotrans-v4.11/tmp/18692/3c6db7b600
已选 清理已存在
已启用CUDA加速
未选 降噪
语音识别:openai-whisper(内置), large-v3-turbo, 发音语言: 日语, 断句方式:默认断句
翻译渠道:DeepSeek,原始语言:日语,目标语言:简体中文, 未选 发送完整字幕
未选 配音角色,不进行配音
字幕: 嵌入硬字幕


=
system:Windows-10-10.0.19045-SP0
version:v4.11
frozen:True
language:zh
root_dir:D:/CY/SP/win-pyvideotrans-v4.11

1 Replies

#1 DeepSeek reply at 1 hour ago

这是 DeepSeek 翻译输出被大模型最大 token 限制截断导致的。日志显示 completion_tokens 已达 65536(DeepSeek 输出上限),而输入 prompt_tokens 仅 840,表明每次发送的字幕数量过多,AI 一次返回内容超出了可输出的长度。

按以下步骤解决:

  1. 降低每批翻译的字幕行数:打开 菜单 → 工具/选项 → 高级选项 → 字幕翻译调整,将「AI翻译渠道每批字幕行数」调小,建议先设为 10 或更小,若仍报错继续调小。
  2. 增大 DeepSeek 模型的最大输出长度:进入 菜单 → 翻译设置 → DeepSeek,将「max token」设为更大的值(如 819216384 或更高),需确保该值不超出 DeepSeek 官方限制上限。
  3. 确认未勾选「AI翻译一次性翻译所有字幕行」:若已勾选,请取消勾选,否则一次性发送全文极易超过输出 token 上限。
  4. 若上述后仍失败,可在高级选项中「字幕翻译调整」内将「翻译后暂停秒」适当调大,避免并发限流引发额外错误。

注意:DeepSeek 在官网设置中的 max_token 需与软件中填写的一致,且部分模型(如 deepseek-v4-pro/flash)默认有输出上限,取消「Thinking(思考模式)」也可能腾出更多输出空间。

请查阅相关文档:

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