Querying the Details About a Model

Function

This API is used to query details about a model based on the model ID.

URI

GET /v1/{project_id}/models/{model_id}

Table 1 describes the required parameters.

Table 1 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.

model_id

Yes

String

Model ID

Request Body

None

Response Body

Table 2 describes the response parameters.

Table 2 Parameters

Parameter

Type

Description

model_id

String

Model ID

model_name

String

Model name

model_version

String

Model version

create_at

Long

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

tenant

String

Tenant to which a model belongs

project

String

Project to which a model belongs

owner

String

User to which a model belongs

source_location

String

OBS path where the model is located or the SWR image location

source_job_id

String

ID of the source training job

source_job_version

String

Version of the source training job

source_type

String

Model source type. If a model is deployed through ExeML, the value is auto. If a model is deployed through a training job or an OBS model file, this parameter is left blank.

model_type

String

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

model_size

Long

Model size, in bytes

model_status

String

Model status

runtime

String

Model runtime environment

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

image path generated after model packaging

input_params

params array

Collection of input parameters of a model. For details, see Table 3.

output_params

params array

Collection of output parameters of a model. For details, see Table 3.

dependencies

dependency array

Package required for running the inference code and model. For details, see Table 4.

model_metrics

String

Model precision

apis

String

All input and output apis parameter information of a model, which is obtained from the model preview

model_source

String

Model source. Options:

  • auto: ExeML

  • algos: built-in algorithm

  • custom: custom model

tunable

Boolean

Whether a model can be tuned. Options:

  • true: yes

  • false: no

market_flag

Boolean

Whether a model is subscribed from the marketplace. Options:

  • true: yes

  • false: no

publishable_flag

Boolean

Whether a model can be published to the marketplace. Options:

  • true: yes

  • false: no

model_docs

GuideDoc array

List of template documents. For details, see Table 7.

health

Object

Model health check interface information. For details, see Table 8.

model_algorithm

String

Model algorithm type. The value can be predict_analysis, object_detection, or image_classification.

model_labels

String array

Model label array.

labels_map

Object

Model label map. The key is fixed to labels, and the value is the model label array.

workspace_id

String

ID of the workspace to which a service belongs. The default value is 0, indicating the default workspace.

install_type

String array

Supported service type for deployment.

specification

Object

Minimum model deployment specifications. For details, see Table 9.

config

String

Model configurations.

Table 3 params parameters

Parameter

Type

Description

url

String

API URL

method

String

Request method, for example, post

protocol

String

Request protocol, for example, HTTP

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

This parameter is optional when param_type is set to int or float. By default, this parameter is left blank.

max

Number

This parameter is optional when param_type is set to int or float. 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 4 dependency parameters

Parameter

Type

Description

installer

String

Installer

packages

package array

Collection of dependency packages. For details, see Table 5.

Table 5 package parameters

Parameter

Type

Description

package_name

String

Name of a dependency package

package_version

String

Version of a dependency package

restraint

String

Version restriction. The value can be EXACT, ATLEAST, or ATMOST.

Table 6 metric parameters

Parameter

Type

Description

f1

Double

F1 score

recall

Double

Recall

precision

Double

Precision

accuracy

Double

Accuracy

Table 7 GuideDoc parameters

Parameter

Type

Description

doc_name

String

Document name

doc_url

String

HTTP(S) link of the document

Table 8 Health parameters

Parameter

Type

Description

url

String

URL of the health check interface

protocol

String

Request protocol of the health check interface. Only HTTP is supported.

initial_delay_seconds

String

After an instance is started, a health check starts after seconds configured in initial_delay_seconds.

timeout_seconds

String

Health check timeout

Table 9 Specification parameters

Parameter

Type

Description

min_cpu

String

Minimum CPU

min_gpu

String

Minimum GPU

min_memory

String

Minimum memory capacity

Samples

The following shows how to query details about a model based on the model ID.

  • Sample request

    GET    https://endpoint/v1/{project_id}/models/{model_id}
    
  • Sample response

    {
    "model_id": "10eb0091-887f-4839-9929-cbc884f1e20e",
    "model_name": "mnist",
    "model_version": "1.0.0",
    "runtime": "python2.7",
    "tenant": "6d28e85aa78b4e1a9b4bd83501bcd4a1",
    "project": "d04c10db1f264cfeb1966deff1a3527c",
    "owner": "6d28e85aa78b4e1a9b4bd83501bcd4a1",
    "source_location": "https://models.obs.xxxx.com/mnist",
    "model_type": "TensorFlow",
    "model_size": 5633481,
    "model_status": "published",
    "execution_code": "https://testmodel.obs.xxxx.com/customize_service.py",
    "image_address": "100.125.5.235:20202/models/10eb0091-887f-4839-9929-cbc884f1e20e:1.0.0",
    "input_params": [{
         "url": "/",
         "method": "post",
         "protocol": "http",
         "param_name": "data",
         "param_type": "object",
         "param_desc": "{\"type\":\"object\",\"properties\":{\"req_data\":{\"items\":[{\"type\":\"object\",\"properties\":{}}],\"type\":\"array\"}}}"       }],
    "output_params": [{
         "url": "/",
         "method": "post",
         "protocol": "http",
         "param_name": "data",
         "param_type": "object",
         "param_desc": "{\"type\":\"object\",\"properties\":{\"resp_data\":{\"type\":\"array\",\"items\":[{\"type\":\"object\",\"properties\":{}}]}}}"       }],
    "dependencies": [{
        "installer": "pip",
        "packages": [{
            "package_name": "pkg1",
            "package_version": "1.0.1",
            "restraint": "ATLEAST"
        }]
    }],
    "model_metrics":"{\"f1\":0.52381,\"recall\":0.666667,\"precision\":0.466667,\"accuracy\":0.625}",
    "apis": "[{\"protocol\":\"http\",\"method\":\"post\",\"url\":\"/\",\"input_params\":{\"type\":\"object\",\"properties\":{\"data\":{\"type\":\"object\",\"properties\":{\"req_data\":{\"items\":[{\"type\":\"object\",\"properties\":{}}],\"type\":\"array\"}}}}},\"output_params\":{\"type\":\"object\",\"properties\":{\"data\":{\"type\":\"object\",\"properties\":{\"resp_data\":{\"type\":\"array\",\"items\":[{\"type\":\"object\",\"properties\":{}}]}}}}}}]",
    "model_labels":[],
    "labels_map":{"labels":[]},
    "workspace_id": "0",
    "install_type": ["realtime", "batch"],
    "specification":{},
    "config":"{\"model_algorithm\": \"image_classification\", \"model_source\": \"auto\", \"tunable\": false, \"downloadable_flag\": true, \"algorithm\": \"resnet_v2_50,mobilenet_v1\", \"metrics\": {\"f1\": 0.912078373015873, \"recall\": 0.9125, \"precision\": 0.9340277777777778, \"accuracy\": 0.263250724969475}, \"model_type\": \"TensorFlow\", \"runtime\": \"tf1.13-python3.6-cpu\", \"apis\": [{\"protocol\": \"https\", \"url\": \"/\", \"method\": \"post\", \"request\": {\"data\": {\"type\": \"object\", \"properties\": {\"images\": {\"type\": \"file\"}}}, \"Content-type\": \"multipart/form-data\"}, \"response\": {\"data\": {\"type\": \"object\", \"required\": [\"predicted_label\", \"scores\"], \"properties\": {\"predicted_label\": {\"type\": \"string\"}, \"scores\": {\"type\": \"array\", \"items\": {\"type\": \"array\", \"minItems\": 2, \"maxItems\": 2, \"items\": [{\"type\": \"string\"}, {\"type\": \"number\"}]}}}}, \"Content-type\": \"multipart/form-data\"}}], \"dependencies\": [{\"installer\": \"pip\", \"packages\": [{\"package_name\": \"numpy\", \"package_version\": \"1.17.0\", \"restraint\": \"EXACT\"}, {\"package_name\": \"h5py\", \"package_version\": \"2.8.0\", \"restraint\": \"EXACT\"}, {\"package_name\": \"Pillow\", \"package_version\": \"5.2.0\", \"restraint\": \"EXACT\"}, {\"package_name\": \"scipy\", \"package_version\": \"1.2.1\", \"restraint\": \"EXACT\"}, {\"package_name\": \"resampy\", \"package_version\": \"0.2.1\", \"restraint\": \"EXACT\"}, {\"package_name\": \"scikit-learn\", \"package_version\": \"0.19.1\", \"restraint\": \"EXACT\"}]}]}"
    }
    

Status Code

For details about the status code, see Table 1.

Error Codes

See Error Codes.