Querying the Details About a Model
Function
This API is used to query the details about a model based on the model ID.
URI
GET /v1/{project_id}/models/{model_id}
|
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
|
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 template address of the SWR image |
|
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 the model is an ExeML model, the value is auto. If the model is deployed by a user 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, MindSpore, 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. Possible values are as follows:
|
|
tunable |
boolean |
Whether a model can be tuned. Possible values are as follows:
|
|
market_flag |
boolean |
Whether a model is subscribed from the marketplace. Possible values are as follows:
|
|
publishable_flag |
boolean |
Whether a model can be published to the marketplace. Possible values are as follows:
|
|
model_docs |
GuideDoc array |
List of template documents |
|
health |
Health structure |
Model health check interface information |
|
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 |
Map |
Model label map. The key is fixed to labels, and the value is the model label array. |
|
workspace_id |
String |
Workspace ID |
|
install_type |
String array |
Supported service type for deployment |
|
specification |
Specification structure |
Minimum model deployment specifications |
|
config |
String |
Model configurations |
|
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 |
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. |
|
Parameter |
Type |
Description |
|---|---|---|
|
installer |
String |
Installer |
|
packages |
package array |
Collection of dependency packages. For details, see Table 5. |
|
Parameter |
Type |
Description |
|---|---|---|
|
f1 |
Double |
F1 score |
|
recall |
Double |
Recall |
|
precision |
Double |
Precision |
|
accuracy |
Double |
Accuracy |
|
Parameter |
Type |
Description |
|---|---|---|
|
doc_name |
String |
Document name |
|
doc_url |
String |
HTTP(S) link of the document |
|
Parameter |
Type |
Description |
|---|---|---|
|
url |
String |
URL of the health check interface |
|
protocol |
String |
Request protocol of the health check interface. Currently, 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 |
|
Parameter |
Type |
Description |
|---|---|---|
|
min_cpu |
String |
Minimum CPU |
|
min_gpu |
String |
Minimum GPU |
|
min_mem |
String |
Minimum memory capacity |
|
min_ascend |
String |
Minimum Ascend |
Samples
The following shows how to query the 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.cn-north-4.myhuaweicloud.com/mnist", "model_type": "TensorFlow", "model_size": 5633481, "model_status": "published", "execution_code": "https://testmodel.obs.cn-north-4.myhuaweicloud.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 Code
For details about the status code, see Table 1.
Last Article: Querying the List of Models
Next Article: Deleting a Model
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.