Help Center> ModelArts> SDK Reference> Model Management> Obtaining Details About a Model
Updated on 2024-03-21 GMT+08:00

Obtaining Details About a Model

You can use the API to obtain the information about a model object.

Sample Code

In ModelArts notebook, you do not need to enter authentication parameters for session authentication. For details about session authentication of other development environments, see Session Authentication.

  • Method 1: Obtain details about a model based on the model object created in Importing a Model.
    1
    2
    3
    4
    5
    6
    7
    from modelarts.session import Session
    from modelarts.model import Model
    
    session = Session()
    model_instance = Model(session, model_id="your_model_id")
    model_info = model_instance.get_model_info()
    print(model_info)
    
  • Method 2: Obtain details about a model based on the model object returned in Obtaining Model Objects.
    1
    2
    3
    4
    5
    6
    7
    8
    from modelarts.session import Session
    from modelarts.model import Model
    
    session = Session()
    model_object_list = Model.get_model_object_list(session)
    model_instance = model_object_list[0]                
    model_info = model_instance.get_model_info()
    print(model_info)
    

Parameters

Table 1 get_model_info response parameters

Parameter

Type

Description

model_id

String

Model ID

model_name

String

Model name

model_version

String

Model version

tenant

String

Tenant

project

String

Project

owner

String

User

create_at

Long

Time when a model is created, in milliseconds calculated from 1970.1.1 0:0:0 UTC

source_location

String

OBS path where a model resides

source_job_id

String

ID of the source training job

source_job_version

String

Version of the source training job

source_type

String

Type of a model source

  • If a model is deployed by an ExeML project, the value is auto.
  • If a model is deployed by a training job or OBS model file, this parameter is left blank.

model_type

String

Model type. The value can be TensorFlow, MXNet, Spark_MLlib, Scikit_Learn, XGBoost, MindSpore, Image, or PyTorch.

model_size

Long

Model size, in bytes

model_status

String

Model status. The value can be publishing, published, or failed.

description

String

Model description

execution_code

String

OBS path for storing the execution code. The name of the execution code file is fixed to customize_service.py.

schema_doc

String

Download address of the model schema file

image_address

String

Execution image path of a model. Before the image is built, that is, before a model has been published as a service, this parameter is left blank.

input_params

params array

Collection of input parameters of a model. By default, this parameter is left blank.

output_params

params array

Collection of output parameters of a model. By default, this parameter is left blank.

dependencies

dependency array

Package required for running the code and model

model_metrics

String

Model evaluation parameter. This parameter is returned only when source_job_id and source_job_version are assigned values and the corresponding training job has evaluation results.

apis

String

All apis input and output parameters of the model

Table 2 params parameters

Parameter

Type

Description

url

String

API URL

param_name

String

Parameter name, which contains a maximum of 64 characters

param_type

String

Parameter type. The value can be int, string, float, timestamp, date, or file.

min

Number

When param_type is set to int or float and min is set during model creation, the value will be returned. By default, this parameter is left blank.

max

Number

When param_type is set to int or float and max is set during model creation, the value will be returned. By default, this parameter is left blank.

param_desc

String

Parameter description, which contains a maximum of 100 characters. By default, this parameter is left blank.

Table 3 dependency parameters

Parameter

Type

Description

installer

String

Installer

packages

package array

Collection of dependency packages

Table 4 package parameters

Parameter

Type

Description

package_name

String

Name of a dependency package

package_version

String

Version of a dependency package

restraint

String

Version filtering criterion. The options are as follows:

  • EXACT: the specified version
  • ATLEAST: not earlier than the specified version
  • ATMOST: not later than the specified version
Table 5 metric parameters

Parameter

Mandatory

Type

Description

f1

Yes

Double

Mean

recall

Yes

Double

Recall

precision

Yes

Double

Precision

accuracy

Yes

Double

Accuracy