Viewing Details About a Model

Function

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

Debugging

You can debug this API through automatic authentication in or use the SDK sample code generated by API Explorer.

URI

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

model_id

Yes

String

Model ID

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID and Name.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. It can be obtained by calling the IAM API that is used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

model_version

String

Model version

source_job_version

String

Version of the source training job

source_location

String

OBS path where the model is located or the template address of the SWR image

source_job_id

String

ID of the source training job

source_copy

String

Whether to enable image replication. This parameter is valid only when model_type is set to Image.

  • true: Default value, indicating that image replication is enabled. After this function is enabled, AI applications cannot be rapidly created, and modifying or deleting an image in the SWR source directory will not affect service deployment.

  • false: Image replication is not enabled. After this function is disabled, AI applications can be rapidly created, but modifying or deleting an image in the SWR source directory will affect service deployment.

description

String

Model description

project

String

Project ID of the tenant to which a model belongs

workspace_id

String

Workspace ID. Value 0 indicates the default workspace.

model_algorithm

String

Model algorithm type, which can be predict_analysis, object_detection, or image_classification

model_name

String

Model name

tenant

String

Account ID of the tenant to which a model belongs

model_docs

Array of GuideDoc objects

List of template documents

owner

String

ID of the tenant to which a model belongs

execution_code

String

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

schema_doc

String

Download address of the model schema file

image_address

String

Image path generated after model packaging

output_params

Array of ModelParamsInfo objects

Collection of output parameters of a model

health

ModelHealth object

Model health check information

runtime

String

Model runtime environment

model_metrics

String

Model precision

source_type

String

Model source type. This parameter is valid and its value is auto only if the model is deployed using ExeML.

model_type

String

Model type, which can be TensorFlow, MXNet, Spark_MLlib, Scikit_Learn, XGBoost, MindSpore, Image, or PyTorch

model_id

String

Model ID

dependencies

Array of ModelDependencies objects

Package required for running the code and model

model_size

Long

Model size, in bytes

model_status

String

Model status

apis

String

All API input and output 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: The model can be tuned.

  • false: The model cannot be tuned.

market_flag

Boolean

Whether a model is subscribed from AI Gallery

  • true: The model is subscribed from AI Gallery.

  • false: The model is not subscribed from AI Gallery.

publishable_flag

Boolean

Whether a model can be published to AI Gallery

  • true: The model can be published to AI Gallery.

  • false: The model cannot be published to AI Gallery

model_labels

Array of strings

Model label array

labels_map

Map<String,String>

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

install_type

Array of strings

Supported service type for deployment

config

String

Model configurations

specification

ModelSpecification object

Minimum specifications for model deployment

input_params

Array of ModelParamsInfo objects

Collection of input parameters of a model

create_at

Long

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

Table 4 GuideDoc

Parameter

Type

Description

doc_url

String

HTTP(S) link of the document

doc_name

String

Document name, which must start with a letter.

Table 5 ModelHealth

Parameter

Type

Description

protocol

String

Request protocol for health check, which can only be HTTP

initial_delay_seconds

String

After an instance is started, a health check starts after the time configured in initial_delay_seconds expires.

timeout_seconds

String

Health check timeout

url

String

Path to the health check API

Table 6 ModelDependencies

Parameter

Type

Description

installer

String

Installation mode. Only pip is supported.

packages

Array of Packages objects

Collection of dependency packages

Table 7 Packages

Parameter

Type

Description

package_version

String

Version of a dependency package. If this parameter is left blank, the latest version is installed by default.

package_name

String

Name of a dependency package. Ensure that the package name is correct and available.

restraint

String

Version restriction, which can be EXACT, ATLEAST, or ATMOST. This parameter is mandatory only when package_version is available.

Table 8 ModelSpecification

Parameter

Type

Description

min_cpu

String

Minimal CPU specifications

min_gpu

String

Minimal GPU specifications

min_memory

String

Minimum memory

min_ascend

String

Minimal Ascend specifications

Table 9 ModelParamsInfo

Parameter

Type

Description

protocol

String

Request protocol, for example, http

url

String

API URL

min

Number

Minimum value of a numeric parameter

method

String

Request method, for example, post

max

Number

Maximum value of a numeric parameter

param_desc

String

Parameters

param_name

String

Parameter

param_type

String

Type

Example Requests

GET https://{endpoint}/v1/{project_id}/models/{model_id}

Example Responses

Status code: 200

Model details

{
  "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.xxxxx.com/mnist",
  "model_type" : "TensorFlow",
  "model_size" : 5633481,
  "model_status" : "published",
  "execution_code" : "https://testmodel.obs.xxxxx.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", "edge" ],
  "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 Codes

Status Code

Description

200

Model details

Error Codes

See Error Codes.