CLI (v2) 模型 YAML 架構

適用於:Azure CLI ml 擴充 Extension v2 (current)

您可以在 找到 https://azuremlschemas.azureedge.net/latest/model.schema.json來源 JSON 架構。

Note

本文件中詳述的 YAML 語法是以最新版 ML CLI v2 延伸模組的 JSON 結構描述為基礎。 此語法僅保證能與最新版的 ML CLI v2 延伸模組搭配運作。 您可以在 https://azuremlschemasprod.azureedge.net/ 找到舊版延伸模組的結構描述。

YAML 語法

Key 類型 Description 允許的值
$schema 字串 YAML 結構描述。
name 字串 Required. 模型的名稱。
version int 模型的版本。 若省略,Azure Machine Learning 會自動產生版本。
description 字串 模型的描述。
tags 物件 模型的標籤典。
path 字串 模型檔案的本機路徑,或模型檔案的雲端路徑 URI。 這可以指向檔案或目錄。
type 字串 模型的儲存格式類型。 適用於無程式代碼部署案例。 custom_model、 、 mlflow_modeltriton_model
flavors 物件 模型的口味。 每個模型儲存格式類型可能都有一或多個支持的類別。 適用於無程式代碼部署案例。
default_deployment_template 物件 模型的預設部署範本。 僅適用於登錄範圍模型。 設定後,參考此模型的部署預設會使用部署範本的設定(如 environment、 instance_type、 和 probes)。
default_deployment_template.asset_id 字串 部署範本的資產 ID。 格式:azureml://registries/<registry-name>/deploymenttemplates/<template-name>/versions/<version>。
allowed_deployment_templates 物件清單 作者指引列出消費者在部署此模型時建議使用的覆蓋範本——一組經過審核的範本。 此清單中不強制執行:部署時指定的覆寫不必包含在此清單中。
allowed_deployment_templates[].asset_id 字串 允許部署範本的資產 ID。 格式:azureml://registries/<registry-name>/deploymenttemplates/<template-name>/labels/latest。

Remarks

az ml model 指令可用於管理Azure Machine Learning模型。

Examples

範例可在 examples GitHub repository 中取得。 以下顯示其中幾個。

YAML:本機檔案

$schema: https://azuremlschemas.azureedge.net/latest/model.schema.json
name: local-file-example
path: mlflow-model/model.pkl
description: Model created from local file.

YAML:MLflow 格式的本機資料夾

$schema: https://azuremlschemas.azureedge.net/latest/model.schema.json
name: local-mlflow-example
path: mlflow-model
type: mlflow_model
description: Model created from local MLflow model directory.

YAML:預設部署範本

$schema: https://azuremlschemas.azureedge.net/latest/model.schema.json
name: my-model
version: 1
path: ./model
default_deployment_template:
  asset_id: azureml://registries/my-registry/deploymenttemplates/my-template/versions/1

YAML:預設與允許的部署範本

$schema: https://azuremlschemas.azureedge.net/latest/model.schema.json
name: my-model
version: 1
type: custom_model
path: ./model
default_deployment_template:
  asset_id: azureml://registries/my-registry/deploymenttemplates/my-template/versions/1
allowed_deployment_templates:
  - asset_id: azureml://registries/my-registry/deploymenttemplates/my-template/labels/latest
  - asset_id: azureml://registries/my-registry/deploymenttemplates/my-template2/labels/latest

下一步