MLflow 存储标签但不 return 它们
MLflow stores tags but does not return them
我运行正在使用以下代码来存储标签然后检索它们。正如您在下面看到的,Mlflow 正在存储一组标签并返回另一组标签。
import mlflow
with mlflow.start_run() as active_run:
tw = { "run_id": 1}
mlflow.set_tags(tw)
print("Tags are ", active_run.data.tags)
print(type(active_run.data.tags))
输出
Tags are {'mlflow.source.name': '/media/Space/AI/anaconda4/lib/python3.7/site-packages/ipykernel_launcher.py', 'mlflow.source.type': 'LOCAL', 'mlflow.user': 'adeel'}
通过mlflow ui查看存储的标签,可以看出代码设置的标签“run_id”实际上存储在运行中。但是,active_run.data.tags 似乎只返回 运行 的 header 信息。
目前,您必须在 MLflow 中再次查询您的 运行 以获得包含您记录的所有信息的 运行。在下面的示例中,我调用 mlflow.get_run(<run_id>)
来实现这一点。
import mlflow
with mlflow.start_run() as active_run:
tags = { "my_tag": 1}
mlflow.set_tags(tags)
# Keep track of the run ID of the active run
run_id = active_run.info.run_id
run = mlflow.get_run(run_id)
print("The tags are ", run.data.tags)
我运行正在使用以下代码来存储标签然后检索它们。正如您在下面看到的,Mlflow 正在存储一组标签并返回另一组标签。
import mlflow
with mlflow.start_run() as active_run:
tw = { "run_id": 1}
mlflow.set_tags(tw)
print("Tags are ", active_run.data.tags)
print(type(active_run.data.tags))
输出
Tags are {'mlflow.source.name': '/media/Space/AI/anaconda4/lib/python3.7/site-packages/ipykernel_launcher.py', 'mlflow.source.type': 'LOCAL', 'mlflow.user': 'adeel'}
通过mlflow ui查看存储的标签,可以看出代码设置的标签“run_id”实际上存储在运行中。但是,active_run.data.tags 似乎只返回 运行 的 header 信息。
目前,您必须在 MLflow 中再次查询您的 运行 以获得包含您记录的所有信息的 运行。在下面的示例中,我调用 mlflow.get_run(<run_id>)
来实现这一点。
import mlflow
with mlflow.start_run() as active_run:
tags = { "my_tag": 1}
mlflow.set_tags(tags)
# Keep track of the run ID of the active run
run_id = active_run.info.run_id
run = mlflow.get_run(run_id)
print("The tags are ", run.data.tags)