查询模型列表
示例代码
在ModelArts Notebook平台,Session鉴权无需输入鉴权参数。其它平台的Session鉴权请参见Session鉴权。
- 场景1:查询当前用户所有模型
1 2 3 4 5 6
from modelarts.session import Session from modelarts.model import Model session = Session() model_list = Model.get_model_list(session) print(model_list)
- 场景2:按照检索条件查询当前用户模型
1 2 3 4 5 6
from modelarts.session import Session from modelarts.model import Model session = Session() model_list = Model.get_model_list(session, model_status="published", model_name="digit", order="desc") print(model_list)
参数说明
参数 | 是否必选 | 参数类型 | 说明 |
|---|---|---|---|
model_name | 否 | String | 模型名称,可支持模糊匹配。 |
model_version | 否 | String | 模型版本。 |
model_status | 否 | String | 模型状态,可根据模型的“publishing”、“published”、“failed”三种状态执行查询。 |
description | 否 | String | 描述信息,可支持模糊匹配。 |
offset | 否 | Integer | 指定要查询页的索引,默认为“0”。 |
limit | 否 | Integer | 指定每一页返回的最大条目数,默认为“280”。 |
sort_by | 否 | String | 指定排序字段,可选“create_at”、“model_version”、“model_size”,默认是可选“create_at”。 |
order | 否 | String | 排序方式,可选“asc”或“desc”,代表递增排序及递减排序,默认是“desc”。 |
workspace_id | 否 | String | 工作空间ID,默认为“0”。 |
参数 | 参数类型 | 描述 |
|---|---|---|
total_count | Integer | 不分页的情况下,符合查询条件的总模型数量。 |
count | Integer | 模型数量。 |
models | model结构数组 | 模型元数据信息。 |
参数 | 参数类型 | 描述 |
|---|---|---|
model_id | String | 模型ID。 |
model_name | String | 模型名称。 |
model_version | String | 模型版本。 |
model_type | String | 模型类型,取值为:TensorFlow/MXNet/Spark_MLlib/Scikit_Learn/XGBoost/MindSpore/Image/PyTorch。 |
model_size | Long | 模型大小,单位为字节数。 |
tenant | String | 模型归属租户。 |
project | String | 模型归属项目。 |
owner | String | 模型归属用户。 |
create_at | Long | 模型创建时间,距'1970.1.1 0:0:0 UTC'的毫秒数。 |
description | String | 模型描述信息。 |
source_type | String | 模型来源的类型,仅当模型为自动学习部署过来时有值,取值为“auto”。 |

