liveBook · Manning

Vertex AI prebuilt container

As explained in Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI

A prepackaged software container that provides a configured runtime for executing a machine-learning workload.

A Vertex AI prebuilt container supplies a configured runtime for executing custom model-training code inside an ML pipeline. The training code must run as a standalone script rather than depend on a local notebook environment. section 11.3.5 section 11.1.2

Prepare the training script for the container by:

  • Removing notebook-only imports, visualizations, and dataset-splitting code handled by the Vertex AI SDK. section 11.3.5
  • Reading configuration and dataset locations from command-line arguments, Cloud Storage URIs, and AIP environment variables. section 11.3.5
  • Writing the trained model to the output directory supplied by the Vertex AI SDK. section 11.3.5

Kuala Lumpur property-price model

A notebook-trained property-price model becomes a container-compatible training script by downloading its configuration from Cloud Storage, assembling train, validation, and test dataframes from URI patterns, and saving the model to the SDK-provided output location. section 11.3.5 section 11.5

Listing 11.3 Copying AIP environment variable values
def assign_container_env_variables():
    OUTPUT_MODEL_DIR = os.getenv("AIP_MODEL_DIR")             #1
    TRAIN_DATA_PATTERN = \
os.getenv("AIP_TRAINING_DATA_URI")                            #2
    EVAL_DATA_PATTERN = \
os.getenv("AIP_VALIDATION_DATA_URI")                          #3
    TEST_DATA_PATTERN = \
os.getenv("AIP_TEST_DATA_URI")                                #4
    return OUTPUT_MODEL_DIR, TRAIN_DATA_PATTERN, \
EVAL_DATA_PATTERN, TEST_DATA_PATTERN

Inspect the environment-variable pattern used to obtain the model output directory and training, validation, and test data locations. section 11.3.5

How Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI covers it

How deep it goes
Explains script adaptations, Cloud Storage inputs, environment variables, and model outputs, but not container construction internals.
Examples
Uses a Kuala Lumpur property-price model and Python listings for configuration, environment variables, dataset assembly, and model saving.
What it assumes
Assumes a training notebook or model script and requires Cloud Storage, a Vertex AI dataset, and service-account access.
What you can do after
Operate/configure a training script to consume pipeline-provided data and configuration and save its model for deployment.
How it connects
Connects training scripts with ML pipelines, Vertex AI SDK, Cloud Storage, service accounts, and Vertex AI endpoints.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI. The section links point to the parts of the book it draws on.