Querying a Model List¶
Function¶
This API is used to query the models that meet the search criteria.
URI¶
GET /v1/{project_id}/models
Table 1 describes the required parameters.
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | Yes | String | Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
model_name | No | String | Model name. Fuzzy match is supported. Note If a model name contains an underscore (_), add the exact_match parameter to the request and set the parameter value to true because the underscore needs to be escaped. This ensures that the query operation can be performed properly. |
model_version | No | String | Model version |
model_status | No | String | Model status. You can query models based on the model status. Options:
|
model_type | No | String | Model type. The models of this type are queried. model_type and not_model_type are mutually exclusive and cannot co-exist. |
not_model_type | No | String | Model type. A list of models of types except for this type are queried. |
description | No | String | Description. Fuzzy match is supported. |
offset | No | Integer | Index of the page to be queried. Default value: 0 |
limit | No | Integer | Maximum number of records returned on each page. The default value is 100. The recommended value ranges from 10 to 50. |
sort_by | No | String | Sorting mode. The value can be create_at, model_version, or model_size. Default value: create_at |
order | No | String | Sorting order. The value can be asc or desc, indicating ascending or descending order. Default value: desc |
workspace_id | No | String | ID of the workspace to which a service belongs. The default value is 0, indicating the default workspace. |
Request Body¶
None
Response Body¶
Table 3 describes the response parameters.
Parameter | Type | Description |
---|---|---|
total_count | Integer | Total number of models that meet the search criteria when no paging is implemented |
count | Integer | Number of models |
models | model array | Model metadata. For details, see Table 4. |
Parameter | Type | Description |
---|---|---|
model_id | String | Model ID |
model_name | String | Model name |
model_version | String | Model version |
model_status | String | Model status |
model_type | String | Model type. The value can be TensorFlow, MXNet, Caffe, Spark_MLlib, Scikit_Learn, XGBoost, MindSpore, Image, or PyTorch. |
model_size | Long | Model size, in bytes |
tenant | String | Tenant to which a model belongs |
project | String | Project to which a model belongs |
owner | String | User to which a model belongs |
create_at | Long | Time when a model is created, in milliseconds calculated from 1970.1.1 0:0:0 UTC |
description | String | Model description |
source_type | String | Model source type. This parameter is valid only when a model is deployed through ExeML. The value is auto. You do not need to set this parameter for a model deployed through a training job. By default, this parameter is left blank. |
workspace_id | String | Workspace ID |
model_source | String | Model source. Options:
|
tunable | Boolean | Whether a model can be tuned. Options:
|
market_flag | Boolean | Whether a model is subscribed from the marketplace. Options:
|
publishable_flag | Boolean | Whether a model can be published to the marketplace. Options:
|
install_type | String array | Model deployment type, determining which service a model can be deployed as. Possible values are real-time (real-time service) and batch (batch service). |
subscription_id | String | Model subscription ID. |
extra | String | Extended field. |
specification | Object | Minimum deployment specifications. For details, see Table 5. |
Parameter | Type | Description |
---|---|---|
min_cpu | String | Minimal CPU specifications |
min_gpu | String | Minimal GPU specifications |
min_memory | String | Minimum memory capacity |
Samples¶
The following shows how to query models.
Sample request
GET https://endpoint/v1/{project_id}/models
Sample response
{ "total_count": 1, "count": 1, "models": [ { "model_name": "mnist", "model_version": "1.0.0", "model_id": "10eb0091-887f-4839-9929-cbc884f1e20e", "model_type": "tensorflow", "model_size": 5012312, "tenant": "6d28e85aa78b4e1a9b4bd83501bcd4a1", "project": "d04c10db1f264cfeb1966deff1a3527c", "owner": "6d28e85aa78b4e1a9b4bd83501bcd4a1", "create_at": 1533041553000, "description": "mnist model", "workspace_id": "0", "specification":{} } ] }
Status Code¶
For details about the status code, see Table 1.
Error Codes¶
See Error Codes.