Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python MLFlow活动运行与环境运行id不匹配_Python_Mlflow - Fatal编程技术网

Python MLFlow活动运行与环境运行id不匹配

Python MLFlow活动运行与环境运行id不匹配,python,mlflow,Python,Mlflow,我正在尝试执行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/"

我正在尝试执行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 ===
我注意到我之前有一个
活动运行
,所以我包含了第一个
if块
,以结束该运行。代码运行成功,我能够在MLFlow UI上记录数据,但现在当我运行它时,我开始遇到同样的问题。在当前开始新运行之前,未找到任何活动运行

仅供参考,我正在Azure服务器上使用代码中提到的相应跟踪URI运行代码


但是,如果我在CLI上的
mlflow run
命令中包含一个参数
--experiment name=“TNF\u EXP”
,则代码运行正常,这主要是因为您已使用
默认实验名称开始运行,然后您正试图将
experiment\u name
设置为“TNF\u EXP”

将建议您使用
mlflow.run(…,experiment\u name=“TNF\u EXP”)
python方法,然后从
CLI
运行它


您可以找到更多信息。

这主要是因为您已使用
默认实验名称开始运行,然后尝试将
实验名称设置为“TNF\u EXP”

将建议您使用
mlflow.run(…,experiment\u name=“TNF\u EXP”)
python方法,然后从
CLI
运行它

你可以找到更多的信息