#2477 TaskCfg(cache_folder=None, target_dir='D:/Houdini Tutorial/rebelway_work_flow/week2', remove_noise=False, is_separate=Fa

240e:365* Posted at: 1 month ago 👁69

翻译字幕阶段出错 [硅基流动] 内容太长超出最大允许Token,请减小内容或增大max_token,或者降低每次发送字幕行数
Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=4096, prompt_tokens=4769, total_tokens=8865, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=None, audio_tokens=None, reasoning_tokens=0, rejected_prediction_tokens=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 927, in run
File "videotrans\translator\_base.py", line 78, in run
File "videotrans\translator\_base.py", line 137, in _run_srt
File "videotrans\translator\_siliconflow.py", line 64, in _item_task
openai.LengthFinishReasonError: Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=4096, prompt_tokens=4769, total_tokens=8865, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=None, audio_tokens=None, reasoning_tokens=0, rejected_prediction_tokens=None), prompt_tokens_details=None)

TaskCfg(cache_folder=None, target_dir='D:/Houdini Tutorial/rebelway_work_flow/week2', remove_noise=False, is_separate=False, detect_language=None, subtitle_language=None, source_language=None, target_language=None, source_language_code='English', target_language_code='Simplified Chinese', source_sub='D:/Houdini Tutorial/rebelway_work_flow/week2/video_2_rbdsolver_start.Simplified Chinese.srt', target_sub='D:/Houdini Tutorial/rebelway_work_flow/week2/video_2_rbdsolver_start.Simplified Chinese.Simplified Chinese.srt', source_wav=None, source_wav_output=None, target_wav=None, target_wav_output=None, subtitles=None, novoice_mp4=None, noextname='video_2_rbdsolver_start.Simplified Chinese', 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=10, tts_type=None, recogn_type=None, model_name=None, split_type=0, voice_autorate=False, video_autorate=False, cuda=False, name='D:/Houdini Tutorial/rebelway_work_flow/week2/video_2_rbdsolver_start.Simplified Chinese.srt', basename='video_2_rbdsolver_start.Simplified Chinese.srt', ext='srt', dirname='D:/Houdini Tutorial/rebelway_work_flow/week2', shound_del_name=None, uuid='25dccbafd3', 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.91
frozen:True
language:zh
root_dir:F:/pyVideoTrans/win-pyvideotrans-v3.91

1 Replies

该错误是由于硅基流动(SiliconFlow)AI翻译接口的Token长度限制导致的。您的字幕内容过长,超过了模型的最大上下文长度(max_token)。请按以下步骤解决:

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

    • 在软件主界面,点击右下角的 “设置更多参数”
    • 在“字幕翻译调整”区域,找到 “每次发送字幕行数”
    • 将数值调小(例如从默认的20行改为 5行 或更少),以降低单次请求的Token数量。
  2. (可选)启用“发送完整字幕”

    • 在同一设置区域,确保 “发送完整字幕” 选项是勾选状态。
    • 这有助于AI模型更好地理解上下文,但可能会增加Token消耗。如果调整行数后仍报错,可以尝试取消勾选此选项。
  3. 检查并调整高级选项(如果存在)

    • 如果问题依旧,请通过菜单栏进入 工具 -> 选项 -> 高级选项
    • 在“字幕翻译调整”部分,确认 “LLM重新断句每批字词数” 设置是否过大,如果过大,请适当调小。

核心原理:通过减少单次发送给AI模型处理的字幕文本量,来避免触发其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.

Related resource