This folder contains instructions on:
- Setting up your Google Cloud project
- Notebook environments
- Setting up Colab
- Setting up Vertex AI Workbench
- Python SDK for Vertex AI
-
Select or create a Google Cloud project. When you first create an account, you get a $300 free credit towards your compute/storage costs.
Google Colab allows you to write and execute Python in your browser with minimal setup.
To use Colab with this repo, please click on the "Open in Colab" link at the top of any notebook file in this repo to launch it in Colab. Then follow the instructions within.
For Colab you will need to authenticate so that you can use Google Cloud from Colab:
from google.colab import auth
auth.authenticate_user()
When using the vertexai Python SDK, you will also need to initialize it with your GCP project_id
and location
:
PROJECT_ID = "your-project-id"
LOCATION = "" #e.g. us-central1
import vertexai
vertexai.init(project=PROJECT_ID, location=LOCATION)
Vertex AI Workbench is the JupyterLab notebook environment on Google Cloud, which enables you to create and customize notebook instances. You do not need extra authentication steps.
To create a new JupyterLab instance on Vertex AI Workbench, follow the instructions here to create a user-managed notebooks instance.
After launching the notebook instance, you can clone this repository in your JupyterLab environment. To do so, open a Terminal in JupyterLab. Then run the command below to clone the repository into your instance:
git clone https://github.com/GoogleCloudPlatform/generative-ai.git
-
Install the Google Cloud SDK.
-
Obtain authentication credentials. Create local credentials by running the following command and following the oauth2 flow (read more about the command here):
gcloud auth application-default login
Install the latest Python SDK:
!pip install google-cloud-aiplatform --upgrade
You will need to initialize vertexai
with your project_id
and location
:
PROJECT_ID = "your-project-id"
LOCATION = "" #e.g. us-central1
import vertexai
vertexai.init(project=PROJECT_ID, location=LOCATION)