#2220 TaskCfg(cache_folder=None, target_dir='F:/影音/4 Temp/新建文件夹/av', remove_noise=False, is_separate=False, detect_language=No

2408:8262* Posted at: 2 days ago 👁20

翻译字幕阶段出错 [兼容AI/本地模型] 内容太长超出最大允许Token,请减小内容或增大max_token,或者降低每次发送字幕行数
Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=40960, prompt_tokens=2625, total_tokens=43585, completion_tokens_details=None, prompt_tokens_details=None)
Traceback (most recent call last):
File "videotrans\task\job.py", line 184, in run
File "videotrans\task\_translate_srt.py", line 45, in trans
File "videotrans\translator\__init__.py", line 912, in run
File "videotrans\translator\_base.py", line 78, in run
File "videotrans\translator\_base.py", line 137, 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 439, in result
File "concurrent\futures\_base.py", line 391, in __get_result
File "tenacity\__init__.py", line 480, in call
File "videotrans\translator\_localllm.py", line 71, in _item_task
openai.LengthFinishReasonError: Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=40960, prompt_tokens=2625, total_tokens=43585, completion_tokens_details=None, prompt_tokens_details=None)

TaskCfg(cache_folder=None, target_dir='F:/影音/4 Temp/新建文件夹/av', remove_noise=False, is_separate=False, detect_language=None, subtitle_language=None, source_language=None, target_language=None, source_language_code='Japanese', target_language_code='Simplified Chinese', source_sub='F:/影音/4 Temp/新建文件夹/av/[email protected]', target_sub='F:/影音/4 Temp/新建文件夹/av/[email protected] Chinese.srt', source_wav=None, source_wav_output=None, target_wav=None, target_wav_output=None, subtitles=None, novoice_mp4=None, noextname='hhd800.com@DVDMS-720', shibie_audio=None, targetdir_mp4=None, instrument=None, vocal=None, back_audio=None, background_music=None, app_mode='biaozhun', subtitle_type=0, volume='+0%', pitch='+0Hz', voice_rate='+0%', voice_role=None, copysrt_rawvideo=False, clear_cache=False, translate_type=8, tts_type=None, recogn_type=None, model_name=None, split_type=0, voice_autorate=False, video_autorate=False, cuda=False, name='F:/影音/4 Temp/新建文件夹/av/[email protected]', basename='[email protected]', ext='srt', dirname='F:/影音/4 Temp/新建文件夹/av', shound_del_name=None, uuid='05e605ce28', remove_silent_mid=False, align_sub_audio=True, enable_diariz=False, nums_diariz=0, rephrase=2, only_out_mp4=False)


=
system:Windows-10-10.0.26100-SP0
version:v3.92
frozen:True
language:zh
root_dir:F:/下载/win-pyvideotrans-v3.92

1 Replies

错误提示明确指出,在使用“兼容AI/本地模型”翻译字幕时,内容长度超出了模型的最大Token限制(此处为40960个completion_tokens)。这通常是因为一次性发送的字幕行数过多。

请按以下步骤调整设置以解决问题:

  1. 进入高级设置:在软件主界面,点击菜单栏的 工具 -> 高级选项
  2. 调整翻译参数:在打开的窗口中,找到 “字幕翻译调整” 区域。
  3. 减少单次发送量:将 “同时翻译字幕数” 的值调小。默认值可能较大,建议先尝试设置为 510
  4. (可选)启用上下文:如果使用的是支持上下文的AI模型(如ChatGPT、DeepSeek等),可以勾选 “发送完整字幕”。这会让模型看到更多上下文,但可能会增加Token消耗,因此需要与第3步配合调整。
  5. 确认并应用:点击“确定”保存设置,然后重新执行翻译任务。

核心原理:通过减少每次发送给AI模型翻译的字幕行数,可以确保单次请求的Token总数不会超过模型的最大限制。

如果调整后问题依旧,请检查你连接的本地或AI模型本身的 max_token 配置是否过低,并考虑在模型端适当调高该限制。

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.

Donate: https://ko-fi.com/jianchang512

Trending Questions