Hello custom training: Set up your project and environment
Stay organized with collections
Save and categorize content based on your preferences.
This page walks through setting up your Google Cloud project to use
Vertex AI and downloading some TensorFlow code for training. You will
also download code for a web app that gets predictions.
Each page assumes that you have already performed the instructions from the
previous pages of the tutorial.
Before you begin
Throughout this tutorial, use Google Cloud console and
Cloud Shell to interact with Google Cloud. Alternatively,
instead of Cloud Shell, you
can use another Bash shell with the Google Cloud CLI installed.
Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
At the bottom of the Google Cloud console, a
Cloud Shell
session starts and displays a command-line prompt. Cloud Shell is a shell environment
with the Google Cloud CLI
already installed and with values already set for
your current project. It can take a few seconds for the session to initialize.
If Cloud Shell does not display
(PROJECT_ID)$
in its prompt (where PROJECT_ID is replaced by your
Google Cloud project ID), then run the following command to
configure Cloud Shell to use your project:
gcloudconfigsetprojectPROJECT_ID
Create a Cloud Storage bucket
Create a regional Cloud Storage bucket in the us-central1
region to use for the rest of this tutorial. As you follow the tutorial, use the
bucket for several purposes:
Store training code for Vertex AI to use in a custom training
job.
Store the model artifacts that your custom training job outputs.
Host the web app that gets predictions from your
Vertex AI endpoint.
To create the Cloud Storage bucket, run the following command in your
Cloud Shell session:
To optionally view the sample code files, run the following command:
ls-lpRhello-custom-sample
The hello-custom-sample directory has four items:
trainer/: A directory of TensorFlow Keras code for training the flower
classification model.
setup.py: A configuration file for packaging the trainer/ directory into
a Python source distribution that Vertex AI can use.
function/: A directory of Python code for a
Cloud Run function that can receive and preprocess
prediction requests from a web browser, send them to Vertex AI,
process the prediction responses, and send them back to the browser.
webapp/: A directory with code and markup for a web app that gets flower
classification predictions from Vertex AI.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[],[],null,["# Hello custom training: Set up your project and environment\n\nThis page walks through setting up your Google Cloud project to use\nVertex AI and downloading some TensorFlow code for training. You will\nalso download code for a web app that gets predictions.\nThis tutorial has several pages:\n\n\u003cbr /\u003e\n\n1. Setting up your project and environment.\n\n2. [Training a custom image classification\n model.](/vertex-ai/docs/tutorials/image-classification-custom/training)\n\n3. [Serving predictions from a custom image classification\n model.](/vertex-ai/docs/tutorials/image-classification-custom/serving)\n\n4. [Cleaning up your project.](/vertex-ai/docs/tutorials/image-classification-custom/cleanup)\n\nEach page assumes that you have already performed the instructions from the\nprevious pages of the tutorial.\n\nBefore you begin\n----------------\n\nThroughout this tutorial, use Google Cloud console and\n[Cloud Shell](/shell/docs) to interact with Google Cloud. Alternatively,\ninstead of Cloud Shell, you\ncan use another Bash shell with the [Google Cloud CLI](/sdk/docs) installed.\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Vertex AI and Cloud Run functions APIs.\n\n\n [Enable the APIs](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com,cloudfunctions)\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Vertex AI and Cloud Run functions APIs.\n\n\n [Enable the APIs](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com,cloudfunctions)\n\n1. In the Google Cloud console, activate Cloud Shell.\n\n [Activate Cloud Shell](https://console.cloud.google.com/?cloudshell=true)\n\n\n At the bottom of the Google Cloud console, a\n [Cloud Shell](/shell/docs/how-cloud-shell-works)\n session starts and displays a command-line prompt. Cloud Shell is a shell environment\n with the Google Cloud CLI\n already installed and with values already set for\n your current project. It can take a few seconds for the session to initialize.\n2. If Cloud Shell does not display\n `(`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`)$`\n in its prompt (where \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e is replaced by your\n Google Cloud project ID), then run the following command to\n configure Cloud Shell to use your project:\n\n gcloud config set project \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n\nCreate a Cloud Storage bucket\n-----------------------------\n\nCreate a regional [Cloud Storage](/storage/docs) bucket in the `us-central1`\nregion to use for the rest of this tutorial. As you follow the tutorial, use the\nbucket for several purposes:\n\n- Store training code for Vertex AI to use in a custom training job.\n- Store the model artifacts that your custom training job outputs.\n- Host the web app that gets predictions from your Vertex AI endpoint.\n\nTo create the Cloud Storage bucket, run the following command in your\nCloud Shell session: \n\n gcloud storage buckets create gs://\u003cvar translate=\"no\"\u003eBUCKET_NAME\u003c/var\u003e --project=\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e --location=us-central1\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: The ID of your Google Cloud project.\n- \u003cvar translate=\"no\"\u003eBUCKET_NAME\u003c/var\u003e: A name that you choose for your bucket. For example, `hello_custom_`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e. Learn about [requirements for bucket\n names](/storage/docs/buckets#naming).\n\nDownload sample code\n--------------------\n\nDownload sample code to use for the rest of the tutorial. \n\n gcloud storage cp gs://cloud-samples-data/ai-platform/hello-custom/hello-custom-sample-v1.tar.gz - | tar -xzv\n\nTo optionally view the sample code files, run the following command: \n\n ls -lpR hello-custom-sample\n\nThe `hello-custom-sample` directory has four items:\n\n- `trainer/`: A directory of TensorFlow Keras code for training the flower\n classification model.\n\n- `setup.py`: A configuration file for packaging the `trainer/` directory into\n a Python source distribution that Vertex AI can use.\n\n- `function/`: A directory of Python code for a\n [Cloud Run function](/functions/docs) that can receive and preprocess\n prediction requests from a web browser, send them to Vertex AI,\n process the prediction responses, and send them back to the browser.\n\n- `webapp/`: A directory with code and markup for a web app that gets flower\n classification predictions from Vertex AI.\n\nWhat's next\n-----------\n\nFollow the [next page of this tutorial](/vertex-ai/docs/tutorials/image-classification-custom/training) to run a custom\ntraining job on Vertex AI."]]