简体   繁体   中英

How can one download the outputs of historical Azure ML experiment Runs via the python API

I'm trying to write a script which can download the outputs from an Azure ML experiment Run after the fact.

Essentially, I want to know how I can get a Run by its runId property (or some other identifier).

I am aware that I have access to the Run object when I create it for the purposes of training. What I want is a way to recreate this Run object later in a separate script, possibly from a completely different environment.

What I've found so far is a way to get a list of ScriptRun objects from an experiment via the get_runs() function. But I don't see a way to use one of these ScriptRun objects to create a Run object representing the original Run and allowing me to download the outputs.

Any help appreciated.

I agree that this could probably be better documented, but fortunately, it's a simple implementation.

this is how you get a run object for an already submitted run for azureml-sdk>=1.16.0 (for the older approach see my answer here )

from azureml.core import Workspace

ws = Workspace.from_config()
run = ws.get_run('YOUR_RUN_ID')

once you have the run object, you can call methods like

  • .get_file_names() to see what files are available (the logs in azureml-logs/ and logs/azureml/ will also be listed)
  • .download_file() to download an individual file
  • .download_files() to download all files that match a given prefix (or all the files)

See the Run object docs for more details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM