Set run description programmatically in mlflow
Question:
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.
Answers:
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
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.
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.
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
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.