Managing runtime versions

AI Platform Prediction uses images to configure the VMs that service your training and prediction requests in the cloud. These images contain the base operating system, core technology packages, pip packages (Python libraries), and operating system packages. Images are upgraded periodically to include new improvements and features. AI Platform Prediction versioning enables you to select the right configuration to work with your model.

Important notes about versioning

  • You should always test your training jobs and models thoroughly when switching to a new runtime version, regardless of whether it's a major or minor update.
  • AI Platform Prediction supports each runtime version for 12 months after its release. After the 12-month period, you can no longer create training jobs, batch prediction jobs, or model versions that use the runtime version.

    Twenty-four months after the release of the runtime version, AI Platform Prediction deletes all model versions that use the runtime version.

    Learn more about the timeline of availability for runtime versions.

Understanding version numbers

The images that AI Platform Prediction uses correspond to the AI Platform Prediction runtime version. The runtime version uses the following format:

major_version.minor_version

Major and minor versions

New major and minor versions are created periodically to incorporate one or more of the following:

  • Releases for:
    • Operating system
    • Supported machine learning frameworks
  • Changes or updates to AI Platform Prediction functionality.

A new major version may include breaking changes that require updates to code written against previous versions. A new minor version should not include breaking changes, and should be backward-compatible with all variations of the same major version.

Selecting runtime versions

Make sure to select the runtime version that supports the latest versions of your machine learning framework and other packages you are using.

The earliest AI Platform Prediction runtime version that provides support for scikit-learn and XGBoost is version 1.4.

You can see the details of each version in the AI Platform Prediction version list.

Runtime versions for online prediction

When you create your model version, make sure to specify the runtime version you want to use for online prediction requests. If your model version's default runtime version is incorrect, create a new model version with the correct runtime version.

Online prediction requests always use the model version's default runtime version. You cannot specify a runtime version to override this in your online prediction request.

Runtime version 2.1 does not currently support scikit-learn or XGBoost for online prediction.

Setting the runtime version

Make sure to specify a runtime version when you create a deployed model version from a trained model. This sets the default runtime version for online and batch prediction requests.

gcloud

Use the --runtime-version flag when you run the gcloud ai-platform versions create command:

gcloud ai-platform versions create version_name \
    --model model_name \
    --origin gs://my/trained/model/path \
    --runtime-version 2.1 \
    --python-version 3.7

Python

Set the runtimeVersion when you define your Version resource:

versionDef = {'name' = 'v1',
    'description' = 'The first iteration of the completely_made_up model',
    'deploymentUri' = 'gs://my/model/output/directory',
    'runtimeVersion' = '2.1',
    'pythonVersion': '3.7'}
 

Setting the runtime version for batch prediction

You can specify a runtime version to use when you create a batch prediction job. If you don't, AI Platform Prediction uses the default runtime version set in the model version.

gcloud

Use the --runtime-version flag when you run the gcloud ai-platform jobs submit prediction command:

gcloud ai-platform jobs submit prediction my_batch_job_333 \
    --model my_model \
    --input-paths gs://my/cloud/storage/data/path/* \
    --output-path gs://my/cloud/storage/data/output/path \
    --region us-central1 \
    --data-format text \
    --runtime-version 2.1

Python

Set the runtimeVersion in PredictionInput:

body = {
    'jobId': 'my_batch_job_333',
    'predictionInput': {
        'dataFormat': 'JSON',
        'inputPaths': ['gs://my/cloud/storage/data/path/*'],
        'outputPath': 'gs://my/cloud/storage/data/output/path',
        'region': 'us-central1',
        'modelName': 'projects/my_project/models/my_model',
        'runtimeVersion': '2.1'}}

What's next