#1390 openai.LengthFinishReasonError: Could not parse response content as the length limit was reached - CompletionUsage(compl

27.10* Posted at: 6 hours ago 👁8

翻译字幕阶段出错:[兼容AI/本地模型] 内容太长超出最大允许Token,请减小内容或增大max_token,或者降低每次发送字幕行数
Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=40960, prompt_tokens=473, total_tokens=41433, completion_tokens_details=None, prompt_tokens_details=None):
Traceback (most recent call last):
File "videotrans\task\job.py", line 146, in run
File "videotrans\task\trans_create.py", line 404, in trans
File "videotrans\translator\__init__.py", line 907, in run
File "videotrans\translator\_base.py", line 81, in run
File "videotrans\translator\_base.py", line 99, 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=40960, prompt_tokens=473, total_tokens=41433, completion_tokens_details=None, prompt_tokens_details=None)


=
system:Windows-10-10.0.26100-SP0
version:v3.83
frozen:True
language:zh
root_dir:E:/软件/win-videotrans-v3.83

1 Replies

错误提示表明您使用的本地AI模型返回的翻译结果过长,超出了模型的最大输出限制(Token限制)。请按以下步骤解决:

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

    • 在顶部菜单栏选择 工具/选项 -> 高级选项
    • 找到"字幕翻译调整"区域,将"AI翻译每次发送字幕行数"的值调小(例如从默认的10改为5或更小)。
  2. 检查本地模型配置

    • 如果您使用的是本地部署的大模型(如通过Ollama),请确认模型的最大输出Token设置是否足够大。
    • 在模型部署配置中,尝试增大max_tokensmax_length参数。
  3. 使用更智能的在线AI模型

    • 考虑切换到在线AI翻译渠道,如Gemini、DeepSeek或OpenAI,它们通常有更高的Token限制。
  4. 分割长视频

    • 如果视频很长,可以考虑先将视频分割成较短的片段分别处理。

调整"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.

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

Trending Questions