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

167.253* Posted at: 2 hours ago 👁7

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


=
system:Windows-10-10.0.26100-SP0
version:v3.84
frozen:True
language:zh
root_dir:G:/AI/win-videotrans-v3.84

1 Replies

这个错误是由于您使用的本地AI模型(通过"兼容AI/本地模型"渠道)的token限制导致的。当前字幕内容过长,超出了模型的最大输出token限制(4096)。

解决方案:

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

    • 在顶部菜单栏选择 工具/选项 -> 高级选项
    • 在"字幕翻译调整"区域,将 AI翻译每次发送字幕行数 的值调小(例如从默认值改为 5 或更小)。
    • 这是最直接有效的解决方法。
  2. 使用更智能的在线AI模型:

    • 考虑切换到 Gemini、DeepSeek、OpenAI 等在线AI翻译渠道,它们通常有更高的token限制和更好的上下文处理能力。
  3. (高级用户)调整本地模型配置:

    • 如果您能控制本地部署的模型,可以尝试增加模型的 max_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

Similar issues already exist

Trending Questions