2

Similar to this question, I'd like to edit/set the description of a run via code, instead of editing it via UI.

To clarify, I don't want to set the description of my entire experiment, only of a single run.

Image showing what I want to edit

waykiki
  • 914
  • 2
  • 9
  • 19

1 Answers1

7

There are two ways to set the description.

1. description parameter

You can set a description using a markdown string for your run in mlflow.start_run() using description parameter. Here is an example.

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

2. mlflow.note.content tag

You can set/edit run names by setting the tag with the key mlflow.note.content, which is what the UI (currently) does under the hood.

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

Result

output of the given example


If you set description parameter and mlflow.note.content tag in mlflow.start_run(), you'll get this error.

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.
Matin Zivdar
  • 593
  • 5
  • 20
  • 1
    Great, thanks for the answer. Before I mark the question as done, is it possible to edit the description of an already active run? – waykiki Aug 12 '22 at 08:33
  • 1
    Yes, you can edit the description of a run using the `mlflow.note.content` tag. @waykiki – Matin Zivdar Aug 12 '22 at 12:38