没有记录任何工件 MLFlow

Flo*_*gel 5 machine-learning python-3.x keras mlflow

我无法在 MLFlow 中存储、查看和检索工件。无论创建新实验并分配正确的实验名称和位置,工件文件夹都是空的。

服务器:mlflow 服务器 --backend-store-uri mlruns/ --default-artifact-root mlruns/ --host 0.0.0.0 --port 5000

创建实验:mlflow.create_experiment(exp_name,artifact_location='mlruns/')

with mlflow.start_run():
    mlflow.log_metric("mse", float(binary))
    mlflow.log_artifact(data_path, "data")
    # log model
    mlflow.keras.log_model(model, "models")
Run Code Online (Sandbox Code Playgroud)

代码编译并运行,但没有记录任何工件。它有 mlflow.log-model.history 文件,但没有 model.h5

小智 2

当我开始使用 MLflow 时,我遇到了同样的问题。

所以这个概念是有两个不同的东西tracking uriartifact uri

tracking uri存储日志并artifact uri存储工件(如 yaml、pkl 等)

但是如果你想要一个通用的 uri,你可以使用 SQLite 作为本地数据库,然后你的命令将是这样的......

mlflow 服务器 --backend-store-uri sqlite:///mlruns.db --主机 0.0.0.0 --端口 5000

Note:如果您正在使用远程服务器,那么您的工件存储也应该是远程存储,它不适用于本地数据库

并且不要忘记显式设置跟踪 uri,有两种方法:

  • 在你的代码中mlflow.set_tracking_uri("sqlite:///mlruns.db")
  • 使用环境变量export MLFLOW_TRACKING_URI=sqlite:///mlruns.db