Querying the Details About a Model¶
You can use the API to query the information about a model object.
Sample Code¶
In the ModelArts notebook instance, 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: Query the details about the model created in Importing a Model.
from modelarts.session import Session from modelarts.model import Model session = Session() model_instance = Model(session, model_id="input your model_id") model_info = model_instance.get_model_info()
Method 2: Query the details about a model object returned in Obtaining the Model Object List.
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()
Parameter Description¶
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
|
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 |
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. |
Parameter | Type | Description |
---|---|---|
installer | String | Installer |
packages | package array | Collection of dependency packages |
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:
|
Parameter | Mandatory | Type | Description |
---|---|---|---|
f1 | Yes | Double | Mean |
recall | Yes | Double | Recall |
precision | Yes | Double | Precision |
accuracy | Yes | Double | Accuracy |