'How to set azure experiment name from the code after 2021-08-18 SDK change?

On 2021-08-18 Microsoft (for our convenience ?) made the following changes to their Azure ML SDK:

Azure Machine Learning Experimentation User Interface. Run Display Name.

  • The Run Display Name is a new, editable and optional display name that can be assigned to a run.
  • This name can help with more effectively tracking, organizing and discovering the runs.
  • The Run Display Name is defaulted to an adjective_noun_guid format (Example: awesome_watch_2i3uns).
  • This default name can be edited to a more customizable name. This can be edited from the Run details page in the Azure Machine Learning studio user interface.

Before this change to the SDK, Run Display Name = experiment name + hash. I was assigning the experiment name from the SDK:

from azureml.core import Experiment
experiment_name = 'yus_runExperiment'
experiment=Experiment(ws,experiment_name)
run = experiment.submit(src)

After the change the Run Display Names are auto-generated.

enter image description here

I do not want to manually edit/change the Run Display Name as I may sometimes run 100-s experiments a day.

I tried to find an answer in the Microsoft documentation, but my attempts have failed.

Is there an Azure SDK function to assign the Run Display Name ?



Solution 1:[1]

It's undocumented (so try at your own risk I guess) but I successfully changed the display name using the following python code.

from azureml.core import Experiment, Run, Workspace

ws = Workspace.from_config()
exp = Experiment(workspace=ws, name=<name>)
run = Run(exp, <run id>)
run.display_name = <new display name>

Solution 2:[2]

Just tested in sdk v1.38.0.

You could do like this:

from azureml.core import Experiment
experiment_name = 'yus_runExperiment'
experiment=Experiment(ws,experiment_name)
run = experiment.submit(src)
run.display_name = "Training"

Screenshot

Solution 3:[3]

Tested inside notebook on AML compute instance and with azureml-sdk version 1.37.0:

from azureml.core import Workspace, Run
run = Run.get_context()
if "OfflineRun" not in run.id:
    # works for an offline run on azureml compute instance
    workspace = run.experiment.workspace
else:
    # For an AML run, do your auth for AML here like:
    # workspace = Workspace(subscription_id, resource_group, workspace_name, auth)
    pass # remove that pass for sure when you're running inside AML cluster
run.display_name = "CustomDisplayName"
run.description = "CustomDescription"
print(f"workspace has the run {run.display_name} with the description {run.description}")

Output:

workspace has the run CustomDisplayName with the description CustomDescription

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jesse Anderson
Solution 2 ericchengyuliucs
Solution 3 Sysanin