#7147 翻译字幕阶段出错 [兼容AI/本地模型] Could not parse response content as the length limit was reached - CompletionUsage(completion_token

89.167**5 Posted at: 2 hours ago

翻译字幕阶段出错 [兼容AI/本地模型] Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=8192, prompt_tokens=482, total_tokens=8674, completion_tokens_details=None, prompt_tokens_details=None)
Traceback (most recent call last):

File "videotrans\translator\_base.py", line 67, in run

File "videotrans\translator\_base.py", line 105, 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 421, in exc_check

tenacity.RetryError: RetryError[]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "videotrans\task\job.py", line 35, in run

File "videotrans\task\job.py", line 137, in process_task

File "videotrans\task\_stage_translate.py", line 31, in trans

File "videotrans\translator\_runner.py", line 67, in run

File "videotrans\translator\_base.py", line 73, in run

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

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

openai.LengthFinishReasonError: Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=8192, prompt_tokens=482, total_tokens=8674, completion_tokens_details=None, prompt_tokens_details=None)
[TransCreate]翻译视频: self.is_copy_video=True,self.video_codec_num=264,self.is_audio_trans=False,self.video_info={'video_fps': 29.97002997002997, 'r_frame_rate': 29.97002997002997, 'video_codec_name': 'h264', 'audio_codec_name': 'aac', 'width': 1920, 'height': 1080, 'time': 7398557, 'streams_len': 2, 'streams_audio': 1, 'video_streams': 1, 'color': 'yuv420p'}
[TaskCfgVTT]当前工作模式: 转录并翻译字幕
原始输入文件名: E:/迅雷云盘/bit/fanyi/[email protected]4,
输出结果保存到文件夹: E:/迅雷云盘/bit/fanyi/_video_out/hhd800.com@MIDA-728-mp4,
临时文件夹: C:/Users/kjncy/Downloads/win-pyvideotrans-v4.12-0908/tmp/3676/24471b2da7
已选 清理已存在
已启用CUDA加速
未选 降噪
语音识别:openai-whisper(内置), large-v3-turbo, 发音语言: 日语, 断句方式:默认断句
翻译渠道:兼容AI/本地模型,原始语言:日语,目标语言:简体中文, 未选 发送完整字幕
输出字幕格式: 目标语言在上双字幕
代理地址:http://127.0.0.1:7897


=
system:Windows-10-10.0.26200-SP0
version:v4.12
frozen:True
language:zh_CN
root_dir:C:/Users/kjncy/Downloads/win-pyvideotrans-v4.12-0908

1 Replies

#1 DeepSeek reply at 2 hours ago

这是AI模型输出长度达到了最大token限制,返回内容被截断,导致无法解析为字幕。常见于本地小模型或未正确设置max_tokens。

解决方案:

  1. 减小每批发送的字幕行数:进入 菜单 → 工具 → 高级选项 → 字幕翻译调整 → AI翻译渠道每批字幕行数,改为 12,避免单次请求输出文本过多。
  2. 增大模型最大输出token:在 菜单 → 翻译设置 → 兼容AI/本地模型 中,将 max_tokens 调大(如 16384),前提是模型支持。
  3. 更换更强模型:优先使用 DeepSeek、OpenAI 等支持更长上下文的模型,本地小模型更容易出现此问题。

请查阅相关文档:

Thinking...
Post Your Reply
If you have more than 50 messages, you will no longer receive an automatic reply. Please ask a new question!
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 via ko-fi.com

Related resource