A model training script is a Python program that turns prepared data and configuration into a trained machine-learning model. In a Vertex AI pipeline, it replaces an interactive notebook and runs inside a container, where Cloud Storage URIs and pipeline-provided environment variables supply its inputs and output location. section 11.3.1 section 11.3.4
Adapting notebook code into a container-ready training script typically involves:
- Removing notebook-only work, such as model diagrams, and leaving the code required for training. section 11.3.5
- Accepting runtime arguments, such as the Cloud Storage URI for a YAML training configuration. section 11.3.5
- Downloading the configuration from Cloud Storage rather than reading the local filesystem. section 11.3.4 section 11.3.5
- Reading training, validation, and test data through AIP environment variables, matching CSV files, and merging them into dataframes. section 11.3.5
- Saving the trained model to the AIP_MODEL_DIR location supplied by Vertex AI. section 11.3.5
From property-price notebook to pipeline job
A notebook that predicts Kuala Lumpur property prices can become a training script by removing its dataset-splitting and visualization code, loading configuration through a --config_bucket argument, assembling CSV subsets from Cloud Storage, and saving the trained model to the pipeline output URI. A pipeline script then creates the container, invokes training, and supports deployment to a Vertex AI endpoint. section 11.3.1 section 11.3.5
Figure 11.28 Training on a local system vs. training with an ML pipeline
Compare local training with pipeline training to see how responsibility shifts from manual file handling and deployment to containerized execution and Vertex AI orchestration. section 11.3.1
