部署MLflow新Prompt Engineering UI遇问题,求解决方案
MLflow Prompt Engineering UI 端点为空问题排查与解决
问题详情
已按官方流程配置MLflow Prompt Engineering UI,config.yaml内容如下:
endpoints: - name: chat endpoint_type: llm/v1/chat model: provider: openai name: gpt-4 config: openai_api_key: $OPENAI_API_KEY
执行操作:
- 进入目标目录:
cd /path/to/dir - 导出OpenAI密钥:
export OPENAI_API_KEY=my_openai_key - 启动部署服务器:
mlflow deployments start-server --config-path config.yaml --port 7000
出现异常:7000端口可访问但仅显示部署页面;启动5000端口的MLflow主服务后,Prompt Engineering页面的端点列表为空,怀疑与已知bug相关。
排查与解决步骤
确认MLflow版本兼容性
该问题在旧版本中存在,需确保使用2.8.0及以上版本。执行mlflow --version查看版本,版本过低则运行pip install --upgrade mlflow升级。显式关联部署服务器与主服务
启动5000端口的MLflow主服务时,必须指定部署服务器地址,否则主服务无法识别端点。执行命令:mlflow ui --port 5000 --deployments-server-uri http://localhost:7000验证环境变量加载
启动部署服务器前,执行echo $OPENAI_API_KEY确认密钥已正确导出;若环境变量传递失败,可临时将密钥直接写入config.yaml(生产环境不推荐):config: openai_api_key: "your_actual_api_key"检查部署服务器可用性
访问http://localhost:7000/invocations,发送测试请求验证服务状态:curl http://localhost:7000/invocations -H "Content-Type: application/json" -d '{ "messages": [{"role": "user", "content": "Hello"}] }'若返回正常ChatCompletion响应,说明部署服务器运行正常。
清理缓存后重启服务
- 关闭所有MLflow进程:
pkill -f mlflow - 删除当前目录下的
mlruns缓存文件夹 - 重新按顺序启动部署服务器和MLflow主服务
- 关闭所有MLflow进程:
内容的提问来源于stack exchange,提问作者Cyrus Mohammadian
相关产品推荐
相关产品推荐

