在 mlflow 中以编程方式设置运行描述

way*_*iki 3 python artificial-intelligence mlflow

与这个问题类似,我想通过代码编辑/设置运行的描述,而不是通过用户界面编辑它。

为了澄清,我不想设置整个实验的描述,而只想设置单次运行的描述。

显示我要编辑的内容的图像

Mat*_*dar 8

设置描述有两种方法。

1、description参数

mlflow.start_run()您可以在使用参数中使用降价字符串为运行设置描述description。这是一个例子。

if __name__ == "__main__":
    # load dataset and other stuff

    run_description = """
### Header
This is a test **Bold**, *italic*, ~~strikethrough~~ text.
[And this is an example hayperlink](http://example.com/).
    """

    with mlflow.start_run(description=run_description) as run:
        # train model and other stuff
Run Code Online (Sandbox Code Playgroud)

2.mlflow.note.content标签

您可以通过使用 key 设置标签来设置/编辑运行名称mlflow.note.content,这就是 UI(当前)在后台执行的操作。

if __name__ == "__main__":
    # load dataset and other stuff

    run_description = """
### Header
This is a test **Bold**, *italic*, ~~strikethrough~~ text.
[And this is an example hayperlink](http://example.com/).
    """

    tags = {
        'mlflow.note.content': run_description
    }

    with mlflow.start_run(tags=tags) as run:
        # train model and other stuff
Run Code Online (Sandbox Code Playgroud)

结果

给定示例的输出


如果您在 中设置description参数和mlflow.note.content标记mlflow.start_run(),您将收到此错误。

Description is already set via the tag mlflow.note.content in tags.
Remove the key mlflow.note.content from the tags or omit the description.
Run Code Online (Sandbox Code Playgroud)