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

cpu
float
default value: None

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

memory_in_gb
float
default value: None

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

gpu
int
default value: None

The number of GPUs to allocate for this resource.

cpu
float
Required

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

memory_in_gb
float
Required

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

gpu
int
Required

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

payload_obj
dict
Required

A JSON object to convert to a ResourceConfiguration object.

Returns

The ResourceConfiguration representation of the provided JSON object.

Return type

serialize

Convert this ResourceConfiguration into a JSON serialized dictionary.

serialize()

Returns

The JSON representation of this ResourceConfiguration.

Return type