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

18.183.**8 Posted at: 1 hour ago

内容太长超出最大允许Token,请减小内容或增大max_token,或者降低每次发送字幕行数
Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=32768, prompt_tokens=2939, total_tokens=35707, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=None, audio_tokens=None, reasoning_tokens=32768, rejected_prediction_tokens=None), prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=0), prompt_cache_hit_tokens=0, prompt_cache_miss_tokens=2939)
Traceback (most recent call last):
File "videotrans\translator\_base.py", line 71, in run
File "videotrans\translator\_base.py", line 200, 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\only_one.py", line 67, in run
File "videotrans\task\_stage_translate.py", line 31, in trans
File "videotrans\translator\_runner.py", line 63, 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 92, in _item_task
openai.LengthFinishReasonError: Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=32768, prompt_tokens=2939, total_tokens=35707, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=None, audio_tokens=None, reasoning_tokens=32768, rejected_prediction_tokens=None), prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=0), prompt_cache_hit_tokens=0, prompt_cache_miss_tokens=2939)

cfg=[TaskCfgVTT]当前工作模式: 翻译视频或音频 单视频模式
原始输入文件名: E:/视频/二级视频素材/故事/牙仙.mp4,
输出结果保存到文件夹: E:/视频/二级视频素材/牙仙-mp4,
临时文件夹: E:/pyvideotrans/tmp/33368/e9aa1c15e6
已选 清理已存在
已选 启用CUDA加速
未选 降噪
语音识别:faster-whisper(本地内置), model_name: distil-large-v3.5, 发音语言: 简体中文, 断句方式:LLM重新断句
翻译渠道:DeepSeek,原始语言:简体中文,目标语言:英语, 已选 发送完整字幕
配音渠道:Index-TTS(本地API), 角色:kongbugushi.wav, 配音语言:英语, 未选 二次语音识别
音量:+0%, 语速:+0%, 已选 音频加速, 已选 视频慢速
字幕: 嵌入软字幕
代理地址:


=
system:Windows-10-10.0.26100-SP0
version:v4.05
frozen:True
language:zh
root_dir:E:/pyvideotrans

3 Replies

#1 DeepSeek reply at 1 hour ago

核心原因:DeepSeek 的思考模式(reasoning)在翻译时占满了 max_token(本轮 32768 个输出 token 全部被思考过程消耗),导致正式翻译文本被截断,返回内容不完整、无法解析。

解决方案(按优先级尝试):

  1. 关闭思考模式或调大 max_token
    打开 菜单 → 翻译设置 → DeepSeek,做以下任一操作:

    • 取消勾选 Thinking(思考模式)复选框,直接用非思考模式翻译;
    • 或把 max_token 调大到 65536 甚至更高(需模型支持,DeepSeek 官方接口通常允许更高上限),以保证“思考过程 + 翻译结果”的总长度足够。
  2. 降低单次翻译的字幕行数
    进入 菜单 → 工具/选项 → 高级选项 → 字幕翻译调整,将 AI翻译渠道每批字幕行数 从默认或当前值调低到 20~30 行。这样单次输出长度会显著减小。
  3. 取消“发送完整字幕”
    如果上述仍复现,可在主界面取消勾选 发送完整字幕,改按纯文本单行/少行方式提交,能进一步降低单次生成量。

注意:如果你需要保留思考模式,必须同步加大 max_token;否则仅调低行数可能仍会触发该错误。

请查阅相关文档:

#2 18.183.**8 reply at 1 hour ago

不开启思考模式是否影响前置提示词的理解

#3 DeepSeek reply at 1 hour ago

关闭思考模式不影响软件向模型发送完整提示词,模型仍然会读取并执行您在提示词中设置的翻译要求;区别在于它不再额外输出内部推理过程,因此不会占用大量 max_token,翻译结果会更直接。

需要留意的是:思考模式在某些复杂语义或需要较多逻辑判断的场景下可能略有优势,取消后对一般字幕翻译通常无实质影响。若您自定义了较复杂的提示词,建议分别开启/关闭实测一次,对比翻译质量即可。

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