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

60.28**8 Posted at: 1 hour ago

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

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

File "videotrans\translator\_base.py", line 142, 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 135, in process_task

File "videotrans\task\translate_srt.py", line 47, in trans

File "videotrans\translator\__init__.py", line 860, in run

File "videotrans\translator\_base.py", line 71, 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=576, prompt_tokens=1472, total_tokens=2048, completion_tokens_details=None, prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=713))
cfg=TaskCfgSTS(uuid='1e5b352ac8', name='C:/Users/DAWN/Desktop/山岸逢花一天 .srt', dirname='C:/Users/DAWN/Desktop', noextname='山岸逢花一天 ', basename='山岸逢花一天 .srt', ext='srt', target_dir='C:/Users/DAWN/Desktop', cache_folder=None, is_cuda=False, source_language=None, source_language_code='Japanese', source_sub='C:/Users/DAWN/Desktop/山岸逢花一天 .srt', source_wav=None, source_wav_output=None, target_language=None, target_language_code='Simplified Chinese', target_sub='C:/Users/DAWN/Desktop/山岸逢花一天 .Simplified Chinese.srt', target_wav=None, target_wav_output=None, translate_type=8)


=
system:Windows-10-10.0.22621-SP0
version:v4.03
frozen:True
language:zh
root_dir:D:/Programs/win-pyvideotrans-v4.03-0626

1 Replies

#1 DeepSeek reply at 1 hour ago

这是字幕翻译时单次发送内容超出所选模型的最大输出 Token(max_tokens)限制导致的。报错中的 total_tokens=2048 说明当前模型的输出上限为 2048,而本次请求已触及该上限。

解决方法按顺序尝试:

  1. 降低每批发送字幕行数:打开 菜单 → 工具/选项 → 高级选项 → 字幕翻译,将 AI翻译渠道每批字幕行数 从当前值调低(如改为 10 或 20),保存后重试。
  2. 增大 max_tokens:在该渠道的设置窗口中调大 max tokens(例如设为 4096 或更高)。
  3. 检查源字幕是否有大量重复文本:如果某行字幕存在大量重复字符,会让 AI 模型陷入循环直到耗尽 Token。请检查原始 SRT 中有无类似 no, no, no... 超长重复内容,若有则删除这些重复文本。
  4. 若以上仍无法解决,可取消勾选“发送完整字幕”,改用逐行提交翻译模式,并限制翻译并发为 1。

如果你的版本是 v4.03,建议升级到最新版 v4.16,旧版本可能存在已修复的相关问题。

请查阅相关文档:

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