CreateModelVersion

Updated at:

Adds a new version to a specified model.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

paimodel:CreateModelVersion

create

*All Resource

*

None None

Request syntax

POST /api/v1/models/{ModelId}/versions HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

ModelId

string

Yes

The model ID. For more information about how to obtain the model ID, see ListModels.

model-dfs1****5c

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The request body.

VersionName

string

No

The model version. The version must be unique within the model. If you do not specify this parameter, the first version defaults to 0.1.0. The minor version number is then incremented by 1 for each subsequent version. For example, the second version defaults to 0.2.0. A version number consists of a major version, a minor version, and a patch version, separated by periods (.). The major and minor versions are numbers. The patch version can start with a number and contain underscores (_) and letters. Examples: 1.1.0 and 2.3.4_beta.

0.1.0

Uri

string

Yes

The URI of the model version, which is the storage location of the model. The following types of model URIs are supported:

  • An HTTP or HTTPS URL of the model. Example: https://myweb.com/mymodel.tar.gz.

  • If the model is stored in Object Storage Service (OSS), the URI must be in the oss://<bucket>.<endpoint>/object format. For more information about endpoints, see Endpoints. Example: oss://mybucket.oss-cn-beijing.aliyuncs.com/mypath/.

oss://mybucket.oss-cn-beijing.aliyuncs.com/mypath/

Labels

array

No

The list of labels.

Label

No

A label.

VersionDescription

string

No

The description of the model version.

情感分析。

FormatType

string

No

The format of the model. Valid values:

  • OfflineModel

  • SavedModel

  • Keras H5

  • Frozen Pb

  • Caffe Prototxt

  • TorchScript

  • XGBoost

  • PMML

  • AlinkModel

  • ONNX

Valid values:

  • OfflineModel :

    OfflineModel

  • SavedModel :

    SavedModel

  • Keras H5 :

    Keras H5

  • Frozen Pb :

    Frozen Pb

  • Caffe Prototxt :

    Caffe Prototxt

  • TorchScript :

    TorchScript

  • XGBoost :

    XGBoost

  • PMML :

    PMML

  • AlinkModel :

    AlinkModel

  • ONNX :

    ONNX

SavedModel

FrameworkType

string

No

The framework of the model. Valid values:

  • Pytorch

  • XGBoost

  • Keras

  • Caffe

  • Alink

  • Xflow

  • TensorFlow

Valid values:

  • Pytorch :

    Pytorch

  • XGBoost :

    XGBoost

  • Keras :

    Keras

  • Caffe :

    Caffe

  • Alink :

    Alink

  • Xflow :

    Xflow

  • TensorFlow :

    TensorFlow

TensorFlow

Options

string

No

The extended fields. This parameter is a JSON string.

{}

Metrics

object

No

The model metrics. The serialized data cannot exceed 8,192 bytes in length.

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

TrainingSpec

object

No

The training configurations. These configurations are used for fine-tuning and incremental training.

{}

InferenceSpec

object

No

The configurations for downstream inference services, such as the processor and container for Elastic Algorithm Service (EAS). Example: { "processor": "tensorflow_gpu_1.12" }

{ "processor": "tensorflow_gpu_1.12" }

SourceType

string

No

The source type of the model. Valid values:

  • Custom (default): The model is custom.

  • PAIFlow: The model is from a PAI pipeline.

  • TrainingService: The model is from a PAI training service.

Valid values:

  • PAIFlow :

    PAIFlow

  • Custom :

    Custom

  • TrainingService :

    TrainingService

PAIFlow

SourceId

string

No

The source ID.

  • If SourceType is set to Custom, this parameter has no format restrictions.

  • If SourceType is PAIFlow or TrainingService, the value must be in the following format:

region=<region_id>,workspaceId=<workspace_id>,kind=<kind>,id=<id>

The fields are described as follows:

  • region: The ID of the Alibaba Cloud region.

  • workspaceId: The ID of the workspace.

  • kind: The type. Valid values: PipelineRun (PAI pipeline) and ServiceJob (training service).

  • id: The unique identifier.

region=cn-shanghai,workspaceId=13**,kind=PipelineRun,id=run-sakdb****jdf

ApprovalStatus

string

No

The approval status. Valid values:

  • Pending: The version is pending approval.

  • Approved: The version is approved for deployment.

  • Rejected: The version is rejected for deployment.

Approved

EvaluationSpec

object

No

The evaluation configurations.

{}

CompressionSpec

object

No

The compression configurations.

{}

ExtraInfo

object

No

Other information.

{ "CoverUris": ["https://e***u.oss-cn-hangzhou.aliyuncs.com/st****017.preview.png"], "TrainedWords": ["albedo_overlord"] }

DistillationSpec

object

No

The distillation configurations.

{}

Response elements

Element

Type

Description

Example

object

The response body.

RequestId

string

The request ID.

21645FCD-BAB9-5742-89AE-AEB27****B2E

VersionName

string

The model version.

0.1.0

Examples

Success response

JSON format

{
  "RequestId": "21645FCD-BAB9-5742-89AE-AEB27****B2E",
  "VersionName": "0.1.0"
}

Error codes

See for a complete list.

Release notes

See Release Notes for a complete list.