ModelProfile class

Definition

Represents a profile run that contains recommended CPU and memory requirements for deploying a model.

A ModelProfile object is returned from the profile(workspace, profile_name, models, inference_config, input_data) method of the Model class.

ModelProfile(workspace, image_id, name, description=None, input_data=None, tags=None, properties=None, recommended_memory=None, recommended_cpu=None, recommended_memory_latency=None, recommended_cpu_latency=None, profile_result_url=None, error=None, error_logs=None)
Inheritance
builtins.object
ModelProfile

Parameters

workspace
Workspace

The workspace object containing the image to retrieve.

image_id
str

The ID of the image associated with the profile name.

name
str

The name of the profile to retrieve.

description
str

Optional profile description.

input_data
varies

The input data used for profiling.

tags
dict({str:str})

Dictionary of mutable tags.

properties
dict({str:str})

Dictionary of appendable properties.

recommended_memory
float

The memory recommendation result from profiling, in GB.

recommended_cpu
float

The CPU recommendation result from profiling, in cores.

recommended_memory_latency
float

The 90th percentile latency of requests while profiling with recommended memory value.

recommended_cpu_latency
float

The 90th percentile latency of requests while profiling with recommended cpu value.

profile_result_url
str

URL for viewing profiling results.

error
str
error_logs
str

URL for viewing profiling error logs.

Remarks

The following example shows how to return a ModelProfile object.


   profile = Model.profile(ws, "profilename", [model], inference_config, test_sample)
   profile.wait_for_profiling(True)
   profiling_results = profile.get_results()
   print(profiling_results)

Methods

get_results()

Return the recommended resource requirements from the profiling run to the user.

serialize()

Convert this Profile into a JSON serialized dictionary.

update_creation_state()

Refresh the current state of the in-memory object.

Perform an in-place update of the properties of the object based on the current state of the corresponding cloud object. This method is primarily used for manual polling of creation state.

wait_for_profiling(show_output=False)

Wait for the model to finish profiling.

get_results()

Return the recommended resource requirements from the profiling run to the user.

get_results()

Returns

A dictionary of recommended resource requirements: recommended CPU and memory.

Return type

serialize()

Convert this Profile into a JSON serialized dictionary.

serialize()

Returns

The JSON representation of this Profile.

Return type

update_creation_state()

Refresh the current state of the in-memory object.

Perform an in-place update of the properties of the object based on the current state of the corresponding cloud object. This method is primarily used for manual polling of creation state.

update_creation_state()

wait_for_profiling(show_output=False)

Wait for the model to finish profiling.

wait_for_profiling(show_output=False)

Parameters

show_output
bool

Indicates whether to print more verbose output. Defaults to False.

default value: False