ALIYUN::PAI::ModelVersion

更新时间:
复制为 MD 格式

ALIYUN::PAI::ModelVersion类型用于创建模型版本。

语法

{
  "Type": "ALIYUN::PAI::ModelVersion",
  "Properties": {
    "ModelId": String,
    "Uri": String,
    "ApprovalStatus": String,
    "ExtraInfo": Map,
    "FormatType": String,
    "FrameworkType": String,
    "InferenceSpec": Map,
    "Labels": List,
    "Metrics": Map,
    "Options": String,
    "SourceType": String,
    "SourceId": String,
    "TrainingSpec": Map,
    "VersionDescription": String,
    "VersionName": String
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

ModelId

String

模型ID。

Uri

String

模型版本URI,即模型存储位置。

可能的取值为:

- 模型的HTTP(S)地址,例如:'https://myweb.com/mymodel.tar.gz '。

- 如果模型存储在OSS中,格式为'oss://./object '。关于endpoint配置,例如,参见OSS:// mybucket/'。

ApprovalStatus

String

审批状态。

取值:

  • Pending:待定。

  • Approved:允许上线。

  • Rejected:不允许上线。

ExtraInfo

Map

附加信息。

FormatType

String

模型格式,

取值:

  • OfflineModel

  • SavedModel

  • Keras H5

  • Frozen Pb

  • Caffe Prototxt

  • TorchScript

  • XGBoost

  • PMML

  • AlinkModel

  • ONNX

FrameworkType

String

模型框架。

取值:

  • Pytorch

  • XGBoost

  • Keras

  • Caffe

  • Alink

  • Xflow

  • TensorFlow

InferenceSpec

Map

描述如何应用到下游推理服务。

例如,描述EAS的处理器和容器。示例:{ "processor": "tensorflow_gpu_1.12" }

Labels

List

模型版本标签列表。

长度最大值为20。更多信息,请参考Labels属性

Metrics

Map

模型指标。

序列化后的长度限制为8192。示例:

{ "Results": [{ "Dataset": { "DatasetId": "d-sdkjanksaklerhfd" }, "Metrics": { "cer": 0.175 } }, { "Dataset": { "Uri": "oss://xxxx/" }, "Metrics": { "cer": 0.172 } }] }

Options

String

扩展字段。

这是一个JSON字符串。

SourceId

String

来源ID。

当来源类型为Custom时,此字段不受限制。

* 当来源为PAIFlowTrainingService时,格式为

'''

region=,workspaceId=,kind=,id=

'''

其中:

- region为阿里云地域ID。

- workspaceId表示工作空间ID。

- kind:类型。取值:PipelineRun(PAIFlow工作流);ServiceJob(训练服务)。

- id:唯一标识符。

SourceType

String

模型来源类型。

取值:

  • Custom:自定义。

  • PAIFlow:PAI工作流。

  • TrainingService:PAI训练服务。

TrainingSpec

Map

训练配置。

用于微调、增量训练的配置。

VersionDescription

String

模型版本描述。

VersionName

String

模型版本,

对每个模型唯一。如果留空此参数,第一个版本默认为0.1.0。之后,次版本号依次递增1。例如,第二个版本号为0.2.0。版本号由主版本号、次版本号和阶段版本号组成,用点号(.)分隔。主版本号和次版本号为数字。阶段版本号以数字开头,可以包含数字、下划线和字母。例如,版本号为1.1.02.3.4_beta。

Labels语法

"Labels": [
  {
    "Value": String,
    "Key": String
  }
]

Labels属性

属性名称

类型

必须

允许更新

描述

约束

Key

String

标签键。

Value

String

标签值。

返回值

Fn::GetAtt

  • Options:扩展字段。JsonString类型。

  • VersionDescription:模型版本描述。

  • SourceType:模型来源类型,可能的取值:

  • SourceId:来源ID。

  • ExtraInfo:其他信息。

  • Labels:模型版本标签列表。

  • TrainingSpec:训练配置。用于微调、增量训练的配置。

  • Uri:模型版本URI,即模型存储位置。

  • GmtModifiedTime:最后更新模型的UTC时间,格式为iso8601。

  • FormatType:模型格式,可能的取值:

  • ApprovalStatus:审批状态,取值如下:

  • Metrics:模型指标。

  • OwnerId:阿里云账号ID。

  • UserId:用户ID。

  • FrameworkType:模型框架,可能的取值:

  • InferenceSpec:描述如何应用到下游推理服务,例如EAS的处理器和容器。

  • VersionName:模型版本。

  • GmtCreateTime:创建模型的UTC时间,格式为ISO8601。

示例

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  VersionDescription:
    Type: String
    Description:
      en: Model version description.
    Default: Null
    Required: false
  FormatType:
    Type: String
    Description:
      en: |-
        Model format, possible values:
        - OfflineModel
        - SavedModel
        - Keras H5
        - Frozen Pb
        - Caffe Prototxt
        - TorchScript
        - XGBoost
        - PMML
        - AlinkModel
        - ONNX.
    AllowedValues:
      - OfflineModel
      - SavedModel
      - Keras H5
      - Frozen Pb
      - Caffe Prototxt
      - TorchScript
      - XGBoost
      - PMML
      - AlinkModel
      - ONNX
    Default: Null
    Required: false
  SourceType:
    Type: String
    Description:
      en: |-
        Model source type, possible values:
        - Custom: Custom.
        - PAIFlow:PAI workflow.
        - TrainingService:PAI training service.
    AllowedValues:
      - Custom
      - PAIFlow
      - TrainingService
    Default: Null
    Required: false
  SourceId:
    Type: String
    Description:
      en: |-
        Source ID.
        * When the source type is Custom, this field is not restricted.
        * When the source is PAIFlow or TrainingService, the format is
        '''
        region=<region_id>,workspaceId=<workspace_id>,kind=<kind>,id=<id>
        '''
        Among them:
        - region is the Alibaba Cloud region ID.
        - workspaceId indicates the workspace ID.
        - kind: is a type. Value: PipelineRun(PAIFlow workflow);ServiceJob (training service).
        - id: is a unique identifier.
    Default: Null
    Required: false
  ApprovalStatus:
    Type: String
    Description:
      en: |-
        Admission status, with values as follows:
        - Pending: to be determined.
        - Approved: Allow to go online.
        - Rejected: Online is not allowed.
    AllowedValues:
      - Pending
      - Approved
      - Rejected
    Default: Null
    Required: false
  ExtraInfo:
    Description:
      en: The additional information.
    Required: false
    Default: Null
    Type: Json
  FrameworkType:
    Type: String
    Description:
      en: |-
        Model framework, possible values:
        - Pytorch
        - XGBoost
        - Keras
        - Caffe
        - Alink
        - Xflow
        - TensorFlow.
    AllowedValues:
      - Pytorch
      - XGBoost
      - Keras
      - Caffe
      - Alink
      - Xflow
      - TensorFlow
    Default: Null
    Required: false
  InferenceSpec:
    Description:
      en: 'Describes how to apply to downstream inference services. For example, describe the processor and container of EAS. Example: { "processor": "tensorflow_gpu_1.12" }'
    Required: false
    Default: Null
    Type: Json
  Metrics:
    Description:
      en: |-
        The metrics for the model. The length after serialization is limited to 8,192. Example:
        { "Results": [{ "Dataset": { "DatasetId": "d-sdkjanksaklerhfd" }, "Metrics": { "cer": 0.175 } }, { "Dataset": { "Uri": "oss://xxxx/" }, "Metrics": { "cer": 0.172 } }] }
    Required: false
    Default: Null
    Type: Json
  Labels:
    Description:
      en: List of model version labels.
    Required: false
    Default: Null
    Type: Json
    MaxLength: 20
    AssociationProperty: List[Parameters]
    AssociationPropertyMetadata:
      Parameters:
        Key:
          Type: String
          Description:
            en: label key.
          Default: Null
          Required: false
        Value:
          Type: String
          Description:
            en: label value.
          Default: Null
          Required: false
  VersionName:
    Type: String
    Description:
      en: The model version, which is unique for each model. If you leave this parameter empty, the first version is 0.1.0 by default. After that, the minor version number is increased by 1 in sequence. For example, the second version number is 0.2.0. A version number consists of a major version number, a minor version number, and a stage version number, separated by periods (.). The major version number and minor version number are numeric. The stage version number begins with a digit and can include numbers, underscores, and letters. For example, the version number is 1.1.0 or 2.3.4_beta.
    Default: Null
    Required: false
  Uri:
    Type: String
    Description:
      en: |-
        Model version URI, that is, the location where the model is stored. Possible values are:
        - The HTTP(S) address of the model, for example: 'https://myweb.com/mymodel.tar.gz '.
        - If the model is stored in OSS, the format is 'oss://<bucket>.<endpoint>/object '. For the endpoint configuration, see [Access domain name and data center](~~ 31837 ~~). For example, see OSS:// mybucket/'.
    Required: true
  TrainingSpec:
    Description:
      en: Training configuration. Configuration for fine-tuning, incremental training.
    Required: false
    Default: Null
    Type: Json
  Options:
    Type: String
    Description:
      en: The extended field. This is a JSON string.
    Default: Null
    Required: false
  ModelId:
    Type: String
    Description:
      en: Model ID. For details about how to obtain the model ID.
    Required: true
Resources:
  ExtensionResource:
    Type: ALIYUN::PAI::ModelVersion
    Properties:
      VersionDescription:
        Ref: VersionDescription
      FormatType:
        Ref: FormatType
      SourceType:
        Ref: SourceType
      SourceId:
        Ref: SourceId
      ApprovalStatus:
        Ref: ApprovalStatus
      ExtraInfo:
        Ref: ExtraInfo
      FrameworkType:
        Ref: FrameworkType
      InferenceSpec:
        Ref: InferenceSpec
      Metrics:
        Ref: Metrics
      Labels:
        Ref: Labels
      VersionName:
        Ref: VersionName
      Uri:
        Ref: Uri
      TrainingSpec:
        Ref: TrainingSpec
      Options:
        Ref: Options
      ModelId:
        Ref: ModelId
Outputs:
  VersionDescription:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - VersionDescription
    Description: Model version description.
  GmtModifiedTime:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - GmtModifiedTime
    Description: Finally, update the model UTC time in the format iso8601.
  FormatType:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - FormatType
    Description: Model format, possible values:.
  SourceType:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - SourceType
    Description: Model source type, possible values:.
  SourceId:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - SourceId
    Description: Source ID.
  ApprovalStatus:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ApprovalStatus
    Description: Admission status, with values as follows:.
  ExtraInfo:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - ExtraInfo
    Description: Other information.
  UserId:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - UserId
    Description: The user ID.
  FrameworkType:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - FrameworkType
    Description: Model framework, possible values:.
  InferenceSpec:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - InferenceSpec
    Description: Describes how to apply to downstream inference services, such as processors and containers of EAS.
  Metrics:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Metrics
    Description: Model indicators.
  Labels:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Labels
    Description: List of model version labels.
  VersionName:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - VersionName
    Description: Model version.
  OwnerId:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - OwnerId
    Description: The Alibaba Cloud account ID.
  Uri:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Uri
    Description: Model version URI, that is, the location where the model is stored.
  TrainingSpec:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - TrainingSpec
    Description: Training configuration. Configuration for fine-tuning, incremental training.
  Options:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - Options
    Description: Extension field. The JsonString type.
  GmtCreateTime:
    Value:
      Fn::GetAtt:
        - ExtensionResource
        - GmtCreateTime
    Description: Create a model UTC time in the format ISO8601.
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "VersionDescription": {
      "Type": "String",
      "Description": {
        "en": "Model version description."
      },
      "Default": null,
      "Required": false
    },
    "FormatType": {
      "Type": "String",
      "Description": {
        "en": "Model format, possible values:\n- OfflineModel\n- SavedModel\n- Keras H5\n- Frozen Pb\n- Caffe Prototxt\n- TorchScript\n- XGBoost\n- PMML\n- AlinkModel\n- ONNX."
      },
      "AllowedValues": [
        "OfflineModel",
        "SavedModel",
        "Keras H5",
        "Frozen Pb",
        "Caffe Prototxt",
        "TorchScript",
        "XGBoost",
        "PMML",
        "AlinkModel",
        "ONNX"
      ],
      "Default": null,
      "Required": false
    },
    "SourceType": {
      "Type": "String",
      "Description": {
        "en": "Model source type, possible values:\n- Custom: Custom.\n- PAIFlow:PAI workflow.\n- TrainingService:PAI training service."
      },
      "AllowedValues": [
        "Custom",
        "PAIFlow",
        "TrainingService"
      ],
      "Default": null,
      "Required": false
    },
    "SourceId": {
      "Type": "String",
      "Description": {
        "en": "Source ID.\n* When the source type is Custom, this field is not restricted.\n* When the source is PAIFlow or TrainingService, the format is\n'''\nregion=<region_id>,workspaceId=<workspace_id>,kind=<kind>,id=<id>\n'''\nAmong them:\n- region is the Alibaba Cloud region ID.\n- workspaceId indicates the workspace ID.\n- kind: is a type. Value: PipelineRun(PAIFlow workflow);ServiceJob (training service).\n- id: is a unique identifier."
      },
      "Default": null,
      "Required": false
    },
    "ApprovalStatus": {
      "Type": "String",
      "Description": {
        "en": "Admission status, with values as follows:\n- Pending: to be determined.\n- Approved: Allow to go online.\n- Rejected: Online is not allowed."
      },
      "AllowedValues": [
        "Pending",
        "Approved",
        "Rejected"
      ],
      "Default": null,
      "Required": false
    },
    "ExtraInfo": {
      "Description": {
        "en": "The additional information."
      },
      "Required": false,
      "Default": null,
      "Type": "Json"
    },
    "FrameworkType": {
      "Type": "String",
      "Description": {
        "en": "Model framework, possible values:\n- Pytorch\n- XGBoost\n- Keras\n- Caffe\n- Alink\n- Xflow\n- TensorFlow."
      },
      "AllowedValues": [
        "Pytorch",
        "XGBoost",
        "Keras",
        "Caffe",
        "Alink",
        "Xflow",
        "TensorFlow"
      ],
      "Default": null,
      "Required": false
    },
    "InferenceSpec": {
      "Description": {
        "en": "Describes how to apply to downstream inference services. For example, describe the processor and container of EAS. Example: { \"processor\": \"tensorflow_gpu_1.12\" }"
      },
      "Required": false,
      "Default": null,
      "Type": "Json"
    },
    "Metrics": {
      "Description": {
        "en": "The metrics for the model. The length after serialization is limited to 8,192. Example:\n{ \"Results\": [{ \"Dataset\": { \"DatasetId\": \"d-sdkjanksaklerhfd\" }, \"Metrics\": { \"cer\": 0.175 } }, { \"Dataset\": { \"Uri\": \"oss://xxxx/\" }, \"Metrics\": { \"cer\": 0.172 } }] }"
      },
      "Required": false,
      "Default": null,
      "Type": "Json"
    },
    "Labels": {
      "Description": {
        "en": "List of model version labels."
      },
      "Required": false,
      "Default": null,
      "Type": "Json",
      "MaxLength": 20,
      "AssociationProperty": "List[Parameters]",
      "AssociationPropertyMetadata": {
        "Parameters": {
          "Key": {
            "Type": "String",
            "Description": {
              "en": "label key."
            },
            "Default": null,
            "Required": false
          },
          "Value": {
            "Type": "String",
            "Description": {
              "en": "label value."
            },
            "Default": null,
            "Required": false
          }
        }
      }
    },
    "VersionName": {
      "Type": "String",
      "Description": {
        "en": "The model version, which is unique for each model. If you leave this parameter empty, the first version is 0.1.0 by default. After that, the minor version number is increased by 1 in sequence. For example, the second version number is 0.2.0. A version number consists of a major version number, a minor version number, and a stage version number, separated by periods (.). The major version number and minor version number are numeric. The stage version number begins with a digit and can include numbers, underscores, and letters. For example, the version number is 1.1.0 or 2.3.4_beta."
      },
      "Default": null,
      "Required": false
    },
    "Uri": {
      "Type": "String",
      "Description": {
        "en": "Model version URI, that is, the location where the model is stored. Possible values are:\n- The HTTP(S) address of the model, for example: 'https://myweb.com/mymodel.tar.gz '.\n- If the model is stored in OSS, the format is 'oss://<bucket>.<endpoint>/object '. For the endpoint configuration, see [Access domain name and data center](~~ 31837 ~~). For example, see OSS:// mybucket/'."
      },
      "Required": true
    },
    "TrainingSpec": {
      "Description": {
        "en": "Training configuration. Configuration for fine-tuning, incremental training."
      },
      "Required": false,
      "Default": null,
      "Type": "Json"
    },
    "Options": {
      "Type": "String",
      "Description": {
        "en": "The extended field. This is a JSON string."
      },
      "Default": null,
      "Required": false
    },
    "ModelId": {
      "Type": "String",
      "Description": {
        "en": "Model ID. For details about how to obtain the model ID."
      },
      "Required": true
    }
  },
  "Resources": {
    "ExtensionResource": {
      "Type": "ALIYUN::PAI::ModelVersion",
      "Properties": {
        "VersionDescription": {
          "Ref": "VersionDescription"
        },
        "FormatType": {
          "Ref": "FormatType"
        },
        "SourceType": {
          "Ref": "SourceType"
        },
        "SourceId": {
          "Ref": "SourceId"
        },
        "ApprovalStatus": {
          "Ref": "ApprovalStatus"
        },
        "ExtraInfo": {
          "Ref": "ExtraInfo"
        },
        "FrameworkType": {
          "Ref": "FrameworkType"
        },
        "InferenceSpec": {
          "Ref": "InferenceSpec"
        },
        "Metrics": {
          "Ref": "Metrics"
        },
        "Labels": {
          "Ref": "Labels"
        },
        "VersionName": {
          "Ref": "VersionName"
        },
        "Uri": {
          "Ref": "Uri"
        },
        "TrainingSpec": {
          "Ref": "TrainingSpec"
        },
        "Options": {
          "Ref": "Options"
        },
        "ModelId": {
          "Ref": "ModelId"
        }
      }
    }
  },
  "Outputs": {
    "VersionDescription": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "VersionDescription"
        ]
      },
      "Description": "Model version description."
    },
    "GmtModifiedTime": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "GmtModifiedTime"
        ]
      },
      "Description": "Finally, update the model UTC time in the format iso8601."
    },
    "FormatType": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "FormatType"
        ]
      },
      "Description": "Model format, possible values:."
    },
    "SourceType": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "SourceType"
        ]
      },
      "Description": "Model source type, possible values:."
    },
    "SourceId": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "SourceId"
        ]
      },
      "Description": "Source ID."
    },
    "ApprovalStatus": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ApprovalStatus"
        ]
      },
      "Description": "Admission status, with values as follows:."
    },
    "ExtraInfo": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ExtraInfo"
        ]
      },
      "Description": "Other information."
    },
    "UserId": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "UserId"
        ]
      },
      "Description": "The user ID."
    },
    "FrameworkType": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "FrameworkType"
        ]
      },
      "Description": "Model framework, possible values:."
    },
    "InferenceSpec": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "InferenceSpec"
        ]
      },
      "Description": "Describes how to apply to downstream inference services, such as processors and containers of EAS."
    },
    "Metrics": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Metrics"
        ]
      },
      "Description": "Model indicators."
    },
    "Labels": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Labels"
        ]
      },
      "Description": "List of model version labels."
    },
    "VersionName": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "VersionName"
        ]
      },
      "Description": "Model version."
    },
    "OwnerId": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "OwnerId"
        ]
      },
      "Description": "The Alibaba Cloud account ID."
    },
    "Uri": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Uri"
        ]
      },
      "Description": "Model version URI, that is, the location where the model is stored."
    },
    "TrainingSpec": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "TrainingSpec"
        ]
      },
      "Description": "Training configuration. Configuration for fine-tuning, incremental training."
    },
    "Options": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Options"
        ]
      },
      "Description": "Extension field. The JsonString type."
    },
    "GmtCreateTime": {
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "GmtCreateTime"
        ]
      },
      "Description": "Create a model UTC time in the format ISO8601."
    }
  }
}