【问题标题】:MLflow stores tags but does not return themMLflow 存储标签但不返回它们
【发布时间】:2021-01-20 18:45:29
【问题描述】:

我正在运行以下代码来存储标签,然后检索它们。正如您在下面看到的,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”其实是存储在run中的。但是,active_run.data.tags 似乎只返回了运行的标头信息。

【问题讨论】:

    标签: mlflow


    【解决方案1】:

    目前,您必须在 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)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-02
      • 1970-01-01
      • 2019-11-02
      • 2019-06-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-10
      • 2020-09-04
      相关资源
      最近更新 更多