#5692 TaskCfgSTS(uuid='eddcb5e6b9', name='E:/迅雷下载/Maigret/Maigret.S02E02.srt', dirname='E:/迅雷下载/Maigret', noextname='Maigret.S

113.66* Posted at: 2 hours ago

翻译字幕阶段出错 [DeepSeek] 内容太长超出最大允许Token,请减小内容或增大max_token,或者降低每次发送字幕行数
Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=8192, prompt_tokens=2941, total_tokens=11133, completion_tokens_details=None, prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=1536), prompt_cache_hit_tokens=1536, prompt_cache_miss_tokens=1405)
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 48, in trans

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

File "videotrans\translator\_base.py", line 72, 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 400, in

File "concurrent\futures\_base.py", line 451, in result

File "concurrent\futures\_base.py", line 403, in __get_result

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

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

openai.LengthFinishReasonError: Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=8192, prompt_tokens=2941, total_tokens=11133, completion_tokens_details=None, prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=1536), prompt_cache_hit_tokens=1536, prompt_cache_miss_tokens=1405)
TaskCfgSTS(uuid='eddcb5e6b9', name='E:/迅雷下载/Maigret/Maigret.S02E02.srt', dirname='E:/迅雷下载/Maigret', noextname='Maigret.S02E02', basename='Maigret.S02E02.srt', ext='srt', target_dir='E:/Tool/pyvideotrans/output/translate', cache_folder=None, is_cuda=False, source_language=None, source_language_code='English', source_sub='E:/迅雷下载/Maigret/Maigret.S02E02.srt', source_wav=None, source_wav_output=None, target_language=None, target_language_code='Simplified Chinese', target_sub='E:/Tool/pyvideotrans/output/translate/Maigret.S02E02.Simplified Chinese.srt', target_wav=None, target_wav_output=None, translate_type=4)


=
system:Windows-10-10.0.19045-SP0
version:v4.01
frozen:True
language:zh
root_dir:E:/Tool/pyvideotrans

1 Replies

这是由于 DeepSeek 的 max_token(最大输出长度)被限制为 8192,而字幕内容过长导致截断报错。

解决办法

  1. 增大 DeepSeek 的 max_token
    进入 菜单 → 翻译设置 → DeepSeek 设置面板,将 max_token 值调大(例如设为 1638432768),保存后重新执行。
  2. 降低每批字幕行数(如果不想调大 max_token)
    进入 菜单 → 工具 → 高级选项 → 字幕翻译调整,将 AI翻译渠道每批字幕行数 从默认值调低(例如设为 10~20),保存后重试。
  3. 拆分字幕文件(备选)
    如果字幕文件本身很长,可以先手动拆分为多个短文件,分别翻译后再合并。

请查阅相关文档:

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: ko-fi.com/jianchang512

Related resource