gcloud beta ai-platform versions create

NAME
gcloud beta ai-platform versions create - create a new AI Platform version
SYNOPSIS
gcloud beta ai-platform versions createVERSION--model=MODEL[--accelerator=[count=COUNT],[type=TYPE]][--async][--config=CONFIG][--description=DESCRIPTION][--explanation-method=EXPLANATION_METHOD][--framework=FRAMEWORK][--labels=[KEY=VALUE,…]][--machine-type=MACHINE_TYPE][--num-integral-steps=NUM_INTEGRAL_STEPS; default=50][--num-paths=NUM_PATHS; default=50][--origin=ORIGIN][--python-version=PYTHON_VERSION][--region=REGION][--runtime-version=RUNTIME_VERSION][--service-account=SERVICE_ACCOUNT][--staging-bucket=STAGING_BUCKET][--args=[ARG,…]--command=[COMMAND,…]--env-vars=[KEY=VALUE,…]--image=IMAGE--ports=[ARG,…]][--health-route=HEALTH_ROUTE--predict-route=PREDICT_ROUTE][--max-nodes=MAX_NODES--metric-targets=[METRIC-NAME=TARGET,…]--min-nodes=MIN_NODES][--package-uris=[PACKAGE_URI,…]--prediction-class=PREDICTION_CLASS][GCLOUD_WIDE_FLAG]
DESCRIPTION
(BETA) Creates a new version of an AI Platform model.

For more details on managing AI Platform models and versions seehttps://cloud.google.com/ai-platform/prediction/docs/managing-models-jobs

EXAMPLES
To create an AI Platform version model with the version ID 'versionId' and withthe name 'model-name', run:
gcloudbetaai-platformversionscreateversionId--model=model-name
POSITIONAL ARGUMENTS
VERSION
Name of the model version.
REQUIRED FLAGS
--model=MODEL
Name of the model.
OPTIONAL FLAGS
--accelerator=[count=COUNT],[type=TYPE]
Manage the accelerator config for GPU serving. When deploying a model withCompute Engine Machine Types, a GPU accelerator may also be selected.
type
The type of the accelerator. Choices are 'nvidia-tesla-a100','nvidia-tesla-k80', 'nvidia-tesla-p100', 'nvidia-tesla-p4', 'nvidia-tesla-t4','nvidia-tesla-v100'.
count
The number of accelerators to attach to each machine running the job. If notspecified, the default value is 1. Your model must be specially designed toaccommodate more than 1 accelerator per machine. To configure how many replicasyour model has, set themanualScaling orautoScalingparameters.
--async
Return immediately, without waiting for the operation in progress to complete.
--config=CONFIG
Path to a YAML configuration file containing configuration parameters for theVersionto create.

The file is in YAML format. Note that not all attributes of a version areconfigurable; available attributes (with example values) are:

description:Afree-formdescriptionoftheversion.deploymentUri:gs://path/to/sourceruntimeVersion:'2.1'#  Set only one of either manualScaling or autoScaling.manualScaling:nodes:10# The number of nodes to allocate for this model.autoScaling:minNodes:0# The minimum number of nodes to allocate for this model.labels:user-defined-key:user-defined-value

The name of the version must always be specified via the required VERSIONargument.

Only one of manualScaling or autoScaling can be specified. If both are specifiedin same yaml file an error will be returned.

If an option is specified both in the configuration file and via command-linearguments, the command-line arguments override the configuration file.

--description=DESCRIPTION
Description of the version.
--explanation-method=EXPLANATION_METHOD
Enable explanations and select the explanation method to use.

The valid options are: integrated-gradients: Use Integrated Gradients.sampled-shapley: Use Sampled Shapley. xrai: Use XRAI.

EXPLANATION_METHOD must be one of:integrated-gradients,sampled-shapley,xrai.

--framework=FRAMEWORK
ML framework used to train this version of the model. If not specified, defaultsto 'tensorflow'.FRAMEWORK must be one of:scikit-learn,tensorflow,xgboost.
--labels=[KEY=VALUE,…]
List of label KEY=VALUE pairs to add.

Keys must start with a lowercase character and contain only hyphens(-), underscores (_), lowercase characters, andnumbers. Values must contain only hyphens (-), underscores(_), lowercase characters, and numbers.

--machine-type=MACHINE_TYPE
Type of machine on which to serve the model. Currently only applies to onlineprediction. For available machine types, seehttps://cloud.google.com/ai-platform/prediction/docs/machine-types-online-prediction#available_machine_types.
--num-integral-steps=NUM_INTEGRAL_STEPS; default=50
Number of integral steps for Integrated Gradients. Only valid when--explanation-method=integrated-gradients or--explanation-method=xrai is specified.
--num-paths=NUM_PATHS; default=50
Number of paths for Sampled Shapley. Only valid when--explanation-method=sampled-shapley is specified.
--origin=ORIGIN
Location ofmodel/ "directory" (seehttps://cloud.google.com/ai-platform/prediction/docs/deploying-models#upload-model).

This overridesdeploymentUri in the--config file. Ifthis flag is not passed,deploymentUrimust bespecified in the file from--config.

Can be a Cloud Storage (gs://) path or local file path (no prefix).In the latter case the files will be uploaded to Cloud Storage and a--staging-bucket argument is required.

--python-version=PYTHON_VERSION
Version of Python used when creating the version. Choices are 3.7, 3.5, and 2.7.However, this value must be compatible with the chosen runtime version for thejob.

Must be used with a compatible runtime version:

  • 3.7 is compatible with runtime versions 1.15 and later.
  • 3.5 is compatible with runtime versions 1.4 through 1.14.
  • 2.7 is compatible with runtime versions 1.15 and earlier.
--region=REGION
Google Cloud region of the regional endpoint to use for this command. For theglobal endpoint, the region needs to be specified asglobal.

Learn more about regional endpoints and see a list of available regions:https://cloud.google.com/ai-platform/prediction/docs/regional-endpoints

REGION must be one of:global,asia-east1,asia-northeast1,asia-southeast1,australia-southeast1,europe-west1,europe-west2,europe-west3,europe-west4,northamerica-northeast1,us-central1,us-east1,us-east4,us-west1.

--runtime-version=RUNTIME_VERSION
AI Platform runtime version for this job. Must be specified unless--master-image-uri is specified instead. It is defined in documentation alongwith the list of supported versions:https://cloud.google.com/ai-platform/prediction/docs/runtime-version-list
--service-account=SERVICE_ACCOUNT
Specifies the service account for resource access control.
--staging-bucket=STAGING_BUCKET
Bucket in which to stage training archives.

Required only if a file upload is necessary (that is, other flags include localpaths) and no other flags implicitly specify an upload path.

Configure the container to be deployed.
--args=[ARG,…]
Comma-separated arguments passed to the command run by the container image. Ifnot specified and no '--command' is provided, the container image's default Cmdis used.
--command=[COMMAND,…]
Entrypoint for the container image. If not specified, the container image'sdefault Entrypoint is run.
--env-vars=[KEY=VALUE,…]
List of key-value pairs to set as environment variables.
--image=IMAGE
Name of the container image to deploy (e.g. gcr.io/myproject/server:latest).
--ports=[ARG,…]
Container ports to receive requests at. Must be a number between 1 and 65535,inclusive.
Flags to control the paths that requests and health checks are sent to.
--health-route=HEALTH_ROUTE
HTTP path to send health checks to inside the container.
--predict-route=PREDICT_ROUTE
HTTP path to send prediction requests to inside the container.
Configure the autoscaling settings to be deployed.
--max-nodes=MAX_NODES
The maximum number of nodes to scale this model under load.
--metric-targets=[METRIC-NAME=TARGET,…]
List of key-value pairs to set as metrics' target for autoscaling. Autoscalingcould be based on CPU usage or GPU duty cycle, valid key could be cpu-usage orgpu-duty-cycle.
--min-nodes=MIN_NODES
The minimum number of nodes to scale this model under load.
Configure user code in prediction.
AIPlatformallowsamodeltohaveuser-providedpredictioncode;theseoptionsconfigurethatcode.
--package-uris=[PACKAGE_URI,…]
Comma-separated list of Cloud Storage URIs ('gs://…') for user-suppliedPython packages to use.
--prediction-class=PREDICTION_CLASS
Fully-qualified name of the custom prediction class in the package provided forcustom prediction.

For example,--prediction-class=my_package.SequenceModel.

GCLOUD WIDE FLAGS
These flags are available to all commands:--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.

Run$gcloud help for details.

NOTES
This command is currently in beta and might change without notice. Thesevariants are also available:
gcloudai-platformversionscreate
gcloudalphaai-platformversionscreate

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-22 UTC.