#2620 TaskCfg(cache_folder='A:/BaiduNetdiskDownload/FY/win-pyvideotrans-v3.91_20251220_225815/tmp/26896/e3c3f6d47c', target_di

223.73* Posted at: 9 hours ago 👁10

翻译字幕阶段出错 [兼容AI/本地模型] 内容太长超出最大允许Token,请减小内容或增大max_token,或者降低每次发送字幕行数
Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=8192, prompt_tokens=558, total_tokens=8750, 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\trans_create.py", line 461, in trans
File "videotrans\translator\__init__.py", line 912, in run
File "videotrans\translator\_base.py", line 79, in run
File "videotrans\translator\_base.py", line 96, 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 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=8192, prompt_tokens=558, total_tokens=8750, completion_tokens_details=None, prompt_tokens_details=None)

TaskCfg(cache_folder='A:/BaiduNetdiskDownload/FY/win-pyvideotrans-v3.91_20251220_225815/tmp/26896/e3c3f6d47c', target_dir='A:/BaiduNetdiskDownload/YQ10929/_video_out/1-5-mp4', remove_noise=False, is_separate=False, detect_language='en', subtitle_language=None, source_language='英语', target_language='简体中文', source_language_code='en', target_language_code='zh-cn', source_sub='A:/BaiduNetdiskDownload/YQ10929/_video_out/1-5-mp4/en.srt', target_sub='A:/BaiduNetdiskDownload/YQ10929/_video_out/1-5-mp4/zh-cn.srt', source_wav='A:/BaiduNetdiskDownload/FY/win-pyvideotrans-v3.91_20251220_225815/tmp/26896/e3c3f6d47c/en.wav', source_wav_output='A:/BaiduNetdiskDownload/YQ10929/_video_out/1-5-mp4/en.m4a', target_wav='A:/BaiduNetdiskDownload/FY/win-pyvideotrans-v3.91_20251220_225815/tmp/26896/e3c3f6d47c/target.wav', target_wav_output='A:/BaiduNetdiskDownload/YQ10929/_video_out/1-5-mp4/zh-cn.m4a', subtitles='', novoice_mp4='A:/BaiduNetdiskDownload/FY/win-pyvideotrans-v3.91_20251220_225815/tmp/26896/e3c3f6d47c/novoice.mp4', noextname='1-5', shibie_audio=None, targetdir_mp4='A:/BaiduNetdiskDownload/YQ10929/_video_out/1-5-mp4/1-5.mp4', instrument=None, vocal=None, back_audio='', background_music=None, app_mode='biaozhun', subtitle_type=0, volume='+0%', pitch='+0Hz', voice_rate='+0%', voice_role='Yunxia(Male/CN)', copysrt_rawvideo=False, clear_cache=False, translate_type=8, tts_type=0, recogn_type=1, model_name='large-v3-turbo', split_type=0, voice_autorate=True, video_autorate=False, cuda=True, name='A:/BaiduNetdiskDownload/YQ10929/1-5.mp4', basename='1-5.mp4', ext='mp4', dirname='A:/BaiduNetdiskDownload/YQ10929', shound_del_name=None, uuid='e3c3f6d47c', remove_silent_mid=False, align_sub_audio=True, enable_diariz=False, nums_diariz=0, rephrase=0, only_out_mp4=False)


=
system:Windows-10-10.0.22621-SP0
version:v3.91
frozen:True
language:zh
root_dir:A:/BaiduNetdiskDownload/FY/win-pyvideotrans-v3.91_20251220_225815

1 Replies

错误提示表明,在使用“兼容AI/本地模型”进行翻译时,AI模型返回的翻译结果长度超过了其最大Token限制(8192)。这通常是因为一次性发送的字幕内容过多。

请按以下步骤调整设置:

  1. 减少每次发送的字幕行数

    • 在软件主界面,点击右下角的 “设置更多参数”
    • 在弹出的窗口中,找到 “每批字幕行数” 选项。
    • 将数值调小,例如从默认的 50 改为 2010。这会减少每次请求的文本量,避免超出模型限制。
  2. (可选)开启“发送完整字幕”

    • 在同一设置窗口中,勾选 “发送完整字幕” 选项。
    • 此选项会让AI模型在翻译时获得更多上下文,有时能改善翻译质量,但可能会增加Token消耗。如果调整行数后问题依旧,可以尝试取消勾选此选项。
  3. 检查并调整AI模型的 max_token 参数

    • 此错误信息 (completion_tokens=8192) 显示模型的最大输出Token限制为8192。
    • 如果你使用的是本地部署的大模型(如通过Ollama、LM Studio等),请确保在模型的配置或启动参数中,将 max_token 或类似参数设置为一个更大的值(例如 16384)。
    • 如果你使用的是在线API(如DeepSeek、OpenAI等),则通常无法修改此限制,只能通过上述第1步减少单次请求量来解决。

核心操作顺序:优先执行 第1步,这是最直接有效的解决方法。如果问题仍存在,再考虑第2步和第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.

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

Trending Questions