MLFlow:考虑以较低的速率运行。我该怎么做?

问题描述 投票:0回答:1

我目前正在尝试设置一个自我管理的 mlflow 实例来评估 Azure OpenAI。我仅根据我在文档中找到的演示和入门代码设置了以下代码:

system_prompt = (
  "The following is a conversation with an AI assistant."
  + "The assistant is helpful and very friendly."
)

example_questions = pd.DataFrame(
    {
        "question": [
            "How do you create a run with MLflow?",
            "How do you log a model with MLflow?",
            "What is the capital of France?",
        ]
    }
)

#start a run
with mlflow.start_run() as run:
    mlflow.autolog()
    mlflow.log_param("system_prompt", system_prompt)

    # Create a question answering model using prompt engineering
    # with OpenAI. Log the model to MLflow Tracking
    logged_model = mlflow.openai.log_model(
        model="gpt-3.5-turbo",
        task=openai.ChatCompletion,
        artifact_path="model",
        messages=[
            {"role": "system", "content": system_prompt},
            {"role": "user", "content": "{question}"},
        ],
    )

    mlflow.evaluate(
        model=logged_model.model_uri,
        model_type="question-answering",
        data=example_questions,
    )

每当我运行此程序时,都会出现以下异常:

MlflowException:  3 tasks failed. See logs for details.
日志似乎说:“考虑以较低的速率运行。”

我对如何降低费率感到困惑,因为我找不到任何相关文档,或者是否还缺少其他东西。

evaluation large-language-model mlflow azure-openai
1个回答
0
投票

如果您查看

mlflow
github 项目来查找此错误,您将在这里找到它:https://github.com/mlflow/mlflow/blob/8a723062c79d1f6382cf2c1139487df903d14c67/mlflow/openai/api_request_parallel_processor.py#L353

如果您检查这些

status_tracker.num_rate_limit_errors
的设置方式:

=> 当“速率限制”是错误消息的一部分时,它会增加,并且如本块开头的注释中所述,可以看到错误:https://platform.openai.com/docs/指南/错误代码/api 错误

基本上,当您同时向 Azure OpenAI 模型发出太多请求时,您会收到此类错误。它可以:

  • 每分钟发送的令牌过多(在多个请求中累积)
  • 但请求也太多(即使里面只有几个令牌)

解决这个问题:

  • 增加 Azure 中部署模型的配额
  • 和/或也许检查是否可以在 mlflow 处理中添加一些延迟
© www.soinside.com 2019 - 2024. All rights reserved.