【发布时间】:2021-05-15 01:18:40
【问题描述】:
我正在尝试执行 MLFlow 运行,但在尝试了很多事情后遇到了以下错误。
run = mlflow.active_run()
if run:
print("Active run_id: {}".format(run.info.run_id))
mlflow.end_run()
mlflow.set_experiment('TNF_EXP')
mlflow.set_tracking_uri("http://localhost:5000/") # Actual Server URI instead of localhost
experiment = mlflow.get_experiment_by_name("TNF_EXP")
with mlflow.start_run(experiment_id=experiment.experiment_id) as run:
...
...
mlflow.end_run()
错误 -
File "/.../ModelTrainer.py", line 108, in train
with mlflow.start_run(experiment_id=experiment.experiment_id) as run:
File "/usr/local/lib/python3.6/site-packages/mlflow/tracking/fluent.py", line 207, in start_run
"arguments".format(existing_run_id)
mlflow.exceptions.MlflowException: Cannot start run with ID e9953eb5918845bb9be1xxxxxx because active run ID does not match environment run ID. Make sure --experiment-name or --experiment-id matches experiment set with set_experiment(), or just use command-line arguments
2021/02/11 09:41:36 ERROR mlflow.cli: === Run (ID 'e9953eb5918845bb9be1xxxxxx') failed ===
我注意到我之前有一个active run,所以我添加了第一个if block 来结束运行。代码成功运行,我能够在 MLFlow UI 上记录数据,但现在当我运行它时,我开始遇到同样的问题。目前在开始新的运行之前没有找到任何活动的运行。
仅供参考,我正在使用代码中提到的相应跟踪 URI 在 Azure 服务器上运行代码。
但是,如果我在 CLI 上的 mlflow run 命令中包含参数 --experiment-name="TNF_EXP",则代码运行良好
【问题讨论】: