Google Cloud AI Platform Operators¶
Google Cloud AI Platform (formerly known as ML Engine) can be used to train machine learning models at scale, host trained models in the cloud, and use models to make predictions for new data. AI Platform is a collection of tools for training, evaluating, and tuning machine learning models. AI Platform can also be used to deploy a trained model, make predictions, and manage various model versions.
The legacy versions of AI Platform Training, AI Platform Prediction, AI Platform Pipelines, and AI Platform Data Labeling Service are deprecated and will no longer be available on Google Cloud after their shutdown date. All the functionality of legacy AI Platform and new features are available on the Vertex AI platform.
Prerequisite tasks¶
To use these operators, you must do a few things:
Select or create a Cloud Platform project using the Cloud Console.
Enable billing for your project, as described in the Google Cloud documentation.
Enable the API, as described in the Cloud Console documentation.
Install API libraries via pip.
pip install 'apache-airflow[google]'Detailed information is available for Installation.
Launching a Job¶
This function is deprecated. All the functionality of legacy MLEngine and new features are available on the Vertex AI platform.
Creating a model¶
A model is a container that can hold multiple model versions. A new model can be created through the
MLEngineCreateModelOperator
.
The model
field should be defined with a dictionary containing the information about the model.
name
is a required field in this dictionary.
Warning
This operator is deprecated. The model is created as a result of running Vertex AI operators that create training jobs
of any types. For example, you can use
CreateCustomPythonPackageTrainingJobOperator
.
The result of running this operator will be ready-to-use model saved in Model Registry.
create_custom_python_package_training_job = CreateCustomPythonPackageTrainingJobOperator(
task_id="create_custom_python_package_training_job",
staging_bucket=f"gs://{CUSTOM_PYTHON_GCS_BUCKET_NAME}",
display_name=PACKAGE_DISPLAY_NAME,
python_package_gcs_uri=PYTHON_PACKAGE_GCS_URI,
python_module_name=PYTHON_MODULE_NAME,
container_uri=TRAIN_IMAGE,
model_serving_container_image_uri=DEPLOY_IMAGE,
bigquery_destination=f"bq://{PROJECT_ID}",
# run params
dataset_id=tabular_dataset_id,
model_display_name=MODEL_DISPLAY_NAME,
replica_count=REPLICA_COUNT,
machine_type=MACHINE_TYPE,
accelerator_type=ACCELERATOR_TYPE,
accelerator_count=ACCELERATOR_COUNT,
training_fraction_split=TRAINING_FRACTION_SPLIT,
validation_fraction_split=VALIDATION_FRACTION_SPLIT,
test_fraction_split=TEST_FRACTION_SPLIT,
region=REGION,
project_id=PROJECT_ID,
)
Getting a model¶
This function is deprecated. All the functionality of legacy MLEngine and new features are available on the Vertex AI platform.
Creating model versions¶
This function is deprecated. All the functionality of legacy MLEngine and new features are available on the Vertex AI platform. For model versioning please check: Model versioning with Vertex AI
Managing model versions¶
This function is deprecated. All the functionality of legacy MLEngine and new features are available on the Vertex AI platform. For model versioning please check: Model versioning with Vertex AI
Making predictions¶
This function is deprecated. All the functionality of legacy MLEngine and new features are available on the Vertex AI platform.
Cleaning up¶
This function is deprecated. All the functionality of legacy MLEngine and new features are available on the Vertex AI platform.
Evaluating a model¶
This function is deprecated. All the functionality of legacy MLEngine and new features are available on the Vertex AI platform. To create and view Model Evaluation, please check the documentation: Evaluate models using Vertex AI
Reference¶
For further information, look at: