RunConfiguration class
Definition
Represents configuration for experiment runs targeting different compute targets in Azure Machine Learning.
The RunConfiguration object encapsulates the information necessary to submit a training run in an experiment. Typically, you will not create a RunConfiguration object directly but get one from a method that returns it, such as the submit(config, tags=None, **kwargs) method of the Experiment class.
RunConfiguration is a base environment configuration that is also used in other types of configuration steps that depend on what kind of run you are triggering. For example, when setting up a PythonScriptStep, you can access the step's RunConfiguration object and configure Conda dependencies or access the environment properties for the run.
For examples of run configurations, see Select and use a compute target to train your model.
RunConfiguration(script=None, arguments=None, framework=None, communicator=None, conda_dependencies=None, _history_enabled=None, _path=None, _name=None)
- Inheritance
-
builtins.objectazureml._base_sdk_common.abstract_run_config_element._AbstractRunConfigElementRunConfiguration
Parameters
- script
- str
The relative path to the Python script file. The file path is relative to the source directory passed to submit(config, tags=None, **kwargs).
- framework
- str
The targeted framework used in the run. Supported frameworks are Python, PySpark, TensorFlow, and PyTorch.
- communicator
- str
The communicator used in the run. The supported communicators are None, ParameterServer, OpenMpi, and IntelMpi. Keep in mind that OpenMpi requires a custom image with OpenMpi installed. Use ParameterServer or OpenMpi for AmlCompute clusters. Use IntelMpi for distributed training jobs.
- conda_dependencies
- CondaDependencies
When left at the default value of False, the system creates a Python environment,
which includes the packages specified in conda_dependencies
.
When set true, an existing Python environment can be specified with the python_interpreter setting.
- auto_prepare_environment
- bool
DEPRECATED. This setting is no longer used.
Remarks
We build machine learning systems typically to solve a specific problem. For example, we might be interested in finding the best model that ranks web pages that might be served as search results corresponding to a query. Our search for the best machine learning model may require us try out different algorithms, or consider different parameter settings, etc.
In the Azure Machine Learning SDK, we use the concept of an experiment to capture the notion that different training runs are related by the problem that they're trying to solve. An Experiment then acts as a logical container for these training runs, making it easier to track progress across training runs, compare two training runs directly, etc.
The RunConfiguration encapsulates execution environment settings necessary to submit a training run in an experiment. It captures both the shared structure of training runs that are designed to solve the same machine learning problem, as well as the differences in the configuration parameters (e.g., learning rate, loss function, etc.) that distinguish distinct training runs from each other.
In typical training scenarios, RunConfiguration is used by creating a ScriptRunConfig object that packages together a RunConfiguration object and an execution script for training.
The configuration of RunConfiguration includes:
Bundling the experiment source directory including the submitted script.
Setting the Command line arguments for the submitted script.
Configuring the path for the Python interpreter.
Obtain Conda configuration for to manage the application dependencies. The job submission process can use the configuration to provision a temp Conda environment and launch the application within. The temp environments are cached and reused in subsequent runs.
Optional usage of Docker and custom base images.
Optional choice of submitting the experiment to multiple types of Azure compute.
Advanced runtime settings for common runtimes like spark and tensorflow.
The following example shows how to submit a training script on your local machine.
from azureml.core import ScriptRunConfig, RunConfiguration, Experiment
# create or load an experiment
experiment = Experiment(workspace, "MyExperiment")
# run a trial from the train.py code in your current directory
config = ScriptRunConfig(source_directory='.', script='train.py',
run_config=RunConfiguration())
run = experiment.submit(config)
Variables
- environment
- Environment
- max_run_duration_seconds
- int
- node_count
- int
- history
- HistoryConfiguration
- spark
- SparkConfiguration
- hdi
- HdiConfiguration
- tensorflow
- TensorflowConfiguration
- mpi
- MpiConfiguration
- data_references
- DataReferenceConfiguration
- data
- Data
- source_directory_data_store
- str
- amlcompute
- AmlComputeConfiguration
Methods
delete(path, name) |
Delete a run configuration file. Raises a UserErrorException if the configuration file is not found. |
load(path, name=None) |
Load a previously saved run configuration file from an on-disk file. If If
|
save(path=None, name=None, separate_environment_yaml=False) |
Save the RunConfiguration to a file on disk. A UserErrorException is raised when:
If If
This method is useful when editing the configuration manually or when sharing the configuration with the CLI. |
delete(path, name)
Delete a run configuration file.
Raises a UserErrorException if the configuration file is not found.
delete(path, name)
Parameters
- path
- str
A user selected root directory for run configurations. Typically this is the Git Repository or the Python project root directory. The configuration is deleted from a sub directory named .azureml.
- name
- str
The configuration file name.
load(path, name=None)
Load a previously saved run configuration file from an on-disk file.
If path
points to a file, the RunConfiguration is loaded from that file.
If
path
points to a directory, which should be a project directory, then the RunConfiguration is loaded
from
load(path, name=None)
Parameters
- path
- str
A user selected root directory for run configurations. Typically this is the Git Repository or the Python project root directory. For backward compatibility, the configuration will also be loaded from .azureml or aml_config sub directory. If the file is not in those directories, the file is loaded from the specified path.
Returns
The run configuration object.
Return type
save(path=None, name=None, separate_environment_yaml=False)
Save the RunConfiguration to a file on disk.
A UserErrorException is raised when:
The RunConfiguration can't be saved with the name specified.
No
name
parameter was specified.The
path
parameter is invalid.
If path
is of the format <dir_path>/<file_name>, where <dir_path> is a valid directory, then the
RunConfiguration is saved at <dir_path>/<file_name>.
If
This method is useful when editing the configuration manually or when sharing the configuration with the CLI.path
points to a directory, which should be a project directory, then the RunConfiguration is saved
at
save(path=None, name=None, separate_environment_yaml=False)
Parameters
- separate_environment_yaml
- bool
Indicates whether to save the Conda environment configuration. If True, the Conda environment configuration is saved to a YAML file named 'environment.yml'.
- path
- str
A user selected root directory for run configurations. Typically this is the Git Repository or the Python project root directory. The configuration is saved to a sub directory named .azureml.
Return type
Attributes
auto_prepare_environment
Get the auto_prepare_environment
parameter. This is a deprecated and unused setting.
target
Get compute target where the job is scheduled for execution.
The default target is "local" refering to the local machine. Available cloud compute targets can be found using the function compute_targets.
Returns
The target name
Return type
Feedback
Loading feedback...