#4909 Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=8192, prompt_tokens

2409:8a55* Posted at: 16 hours ago

Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=8192, prompt_tokens=16002, total_tokens=24194, completion_tokens_details=None, prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=1024), prompt_cache_hit_tokens=1024, prompt_cache_miss_tokens=14978)语音识别阶段出错:faster-whisper(本地), 翻译字幕阶段出错: DeepSeek, 配音阶段出错:Index-TTS(本地API)
Traceback (most recent call last):
File "videotrans\task\only_one.py", line 68, in run
File "videotrans\task\trans_create.py", line 585, 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=16002, total_tokens=24194, completion_tokens_details=None, prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=1024), prompt_cache_hit_tokens=1024, prompt_cache_miss_tokens=14978)
TaskCfgVTT(uuid='16516fdaa8', name='E:/0DayDown/教程_Tutorials/待传/020/4. Create a Landscape with World Partition.mp4', dirname='E:/0DayDown/教程_Tutorials/待传/020', noextname='4. Create a Landscape with World Partition', basename='4. Create a Landscape with World Partition.mp4', ext='mp4', target_dir='E:/0DayDown/教程_Tutorials/待传/020/_video_out/4. Create a Landscape with World Partition-mp4', cache_folder='D:/win-pyvideotrans-v4.01-0602/tmp/45328/16516fdaa8', is_cuda=True, source_language='英语', source_language_code='en', source_sub='E:/0DayDown/教程_Tutorials/待传/020/_video_out/4. Create a Landscape with World Partition-mp4/en.srt', source_wav='D:/win-pyvideotrans-v4.01-0602/tmp/45328/16516fdaa8/en.wav', source_wav_output='E:/0DayDown/教程_Tutorials/待传/020/_video_out/4. Create a Landscape with World Partition-mp4/en.m4a', target_language='简体中文', target_language_code='zh-cn', target_sub='E:/0DayDown/教程_Tutorials/待传/020/_video_out/4. Create a Landscape with World Partition-mp4/zh-cn.srt', target_wav='D:/win-pyvideotrans-v4.01-0602/tmp/45328/16516fdaa8/target.wav', target_wav_output='E:/0DayDown/教程_Tutorials/待传/020/_video_out/4. Create a Landscape with World Partition-mp4/zh-cn.m4a', translate_type=4, tts_type=9, volume='+0%', pitch='+0Hz', voice_rate='+0%', voice_role='Sound_005_90.m4a', voice_autorate=True, video_autorate=False, remove_silent_mid=False, align_sub_audio=True, detect_language='en', recogn_type=0, model_name='large-v3-turbo', shibie_audio=None, remove_noise=False, enable_diariz=False, nums_diariz=0, rephrase=1, fix_punc=True, subtitle_language=None, app_mode='biaozhun', subtitles='', targetdir_mp4='E:/0DayDown/教程_Tutorials/待传/020/_video_out/4. Create a Landscape with World Partition-mp4/4. Create a Landscape with World Partition.mp4', novoice_mp4='D:/win-pyvideotrans-v4.01-0602/tmp/45328/16516fdaa8/novoice.mp4', is_separate=False, embed_bgm=False, instrument=None, vocal='D:/win-pyvideotrans-v4.01-0602/tmp/45328/16516fdaa8/vocal.wav', clear_cache=False, background_music='', subtitle_type=3, only_out_mp4=False, recogn2pass=False, output_srt=2, copysrt_rawvideo=False, loop_backaudio=1, backaudio_volume=0.8)

1 Replies

翻译阶段出错的原因是 DeepSeek 的 max_tokens 设置过低。当前配置为 8192,但发送给模型的内容(加上提示词和完整字幕)总计 24194 tokens,导致输出被截断,DeepSeek 返回了 LengthFinishReasonError

解决方法(任选其一,推荐方法1):

  1. 增大 max_tokens(最直接)

    • 打开菜单 翻译设置DeepSeek 设置面板,将 max_tokens 值增大到 16384 或更高(如 32768)。保存后重新执行任务。
  2. 取消“发送完整字幕”

    • 在主界面翻译渠道区域,取消勾选 “发送完整字幕”。这样会改为逐行翻译,避免一次性发送过多内容导致超限。
  3. 减少每批字幕行数

    • 在菜单 工具/选项高级选项字幕翻译调整 中,将 AI翻译渠道每批字幕行数 从默认值调低(如 10 或 5),减少单次请求的数据量。

关于其他阶段的错误提示

  • 语音识别阶段 faster-whisper 报错:日志中未提供细节,请确认 GPU 显存是否足够(模型 large-v3-turbo 需约 6GB+ 显存),或尝试勾选 降噪 并降低模型大小。
  • 配音阶段 Index-TTS 报错:若参考音频文件名配置不正确或服务未启动,请检查 f5-tts/ 文件夹内是否存在对应的 .wav 文件,并确认外部 API 地址 http://127.0.0.1:7860 正确运行。

如果翻译问题解决后其他阶段仍报错,请提供 logs/ 目录下对应日期的完整日志(底部30行)以便进一步分析。

请查阅相关文档:

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

Similar issues already exist