ResourceConfiguration Class

Defines the details for the resource configuration of Azure Machine Learning resources.

Initialize the ResourceConfiguration.

Inheritance
builtins.object
ResourceConfiguration

Constructor

ResourceConfiguration(cpu=None, memory_in_gb=None, gpu=None)

Parameters

Name Description
cpu

The number of CPU cores to allocate for this resource. Can be a decimal.

Default value: None
memory_in_gb

The amount of memory (in GB) to allocate for this resource. Can be a decimal.

Default value: None
gpu
int

The number of GPUs to allocate for this resource.

Default value: None
cpu
Required

The number of CPU cores to allocate for this resource. Can be a decimal.

memory_in_gb
Required

The amount of memory (in GB) to allocate for this resource. Can be a decimal.

gpu
Required
int

The number of GPUs to allocate for this resource.

Remarks

Initialize a resource configuration with this class. For example, the following code shows how to register a model specifying framework, input and output datasets, and resource configuration.


   import sklearn

   from azureml.core import Model
   from azureml.core.resource_configuration import ResourceConfiguration


   model = Model.register(workspace=ws,
                          model_name='my-sklearn-model',                # Name of the registered model in your workspace.
                          model_path='./sklearn_regression_model.pkl',  # Local file to upload and register as a model.
                          model_framework=Model.Framework.SCIKITLEARN,  # Framework used to create the model.
                          model_framework_version=sklearn.__version__,  # Version of scikit-learn used to create the model.
                          sample_input_dataset=input_dataset,
                          sample_output_dataset=output_dataset,
                          resource_configuration=ResourceConfiguration(cpu=1, memory_in_gb=0.5),
                          description='Ridge regression model to predict diabetes progression.',
                          tags={'area': 'diabetes', 'type': 'regression'})

   print('Name:', model.name)
   print('Version:', model.version)

Methods

deserialize

Convert a JSON object into a ResourceConfiguration object.

serialize

Convert this ResourceConfiguration into a JSON serialized dictionary.

deserialize

Convert a JSON object into a ResourceConfiguration object.

static deserialize(payload_obj)

Parameters

Name Description
payload_obj
Required

A JSON object to convert to a ResourceConfiguration object.

Returns

Type Description

The ResourceConfiguration representation of the provided JSON object.

serialize

Convert this ResourceConfiguration into a JSON serialized dictionary.

serialize()

Returns

Type Description

The JSON representation of this ResourceConfiguration.