|
1 | | -# Setup instructions to use Generative AI on Google Cloud |
| 1 | +# Environment Setup for Generative AI on Google Cloud |
2 | 2 |
|
3 | | -This folder contains instructions on: |
| 3 | +This directory provides comprehensive instructions for setting up your environment to work with the generative AI examples and resources in this repository. |
4 | 4 |
|
5 | | -- Setting up your Google Cloud project |
6 | | -- Notebook environments |
7 | | - - Setting up Colab |
8 | | - - Setting up Vertex AI Workbench |
9 | | -- Python SDK for Vertex AI |
| 5 | +The primary content of this directory is this README file, which guides you through: |
10 | 6 |
|
11 | | -## Setting up your Google Cloud project |
| 7 | +- **Google Cloud Project Configuration**: Steps to select or create a Google Cloud project, enable billing, and activate necessary APIs like Vertex AI and Google Cloud Storage. |
| 8 | +- **Notebook Environments**: Detailed instructions for setting up popular notebook environments: |
| 9 | + - **Google Colab**: How to use notebooks from this repository in Colab, including authentication. |
| 10 | + - **Vertex AI Workbench**: How to create and use user-managed notebook instances on Vertex AI Workbench, and clone this repository. |
| 11 | +- **Local Development**: Information on installing the Google Cloud SDK and authenticating for local development. |
| 12 | +- **Python SDK for Vertex AI**: How to install the `google-cloud-aiplatform` library and initialize it for use with your project. |
12 | 13 |
|
13 | | -1. [Select or create a Google Cloud project](https://console.cloud.google.com/cloud-resource-manager). |
14 | | - When you first create an account, you get a $300 free credit towards your compute/storage costs. |
15 | | - |
16 | | -2. [Make sure that billing is enabled for your project](https://cloud.google.com/billing/docs/how-to/modify-project). |
17 | | - |
18 | | -3. [Enable the Vertex AI API and Google Cloud Storage API](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com,storage.googleapis.com). |
19 | | - |
20 | | -## Notebook environments |
21 | | - |
22 | | -### Colab |
23 | | - |
24 | | -[Google Colab](https://colab.research.google.com/) allows you to write and execute Python in your browser with minimal setup. |
25 | | - |
26 | | -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. |
27 | | - |
28 | | -For Colab you will need to authenticate so that you can use Google Cloud from Colab: |
29 | | - |
30 | | -```py |
31 | | -from google.colab import auth |
32 | | -auth.authenticate_user() |
33 | | -``` |
34 | | - |
35 | | -When using the vertexai Python SDK, you will also need to initialize it with your Google Cloud `project_id` and `location`: |
36 | | - |
37 | | -```py |
38 | | -PROJECT_ID = "your-project-id" |
39 | | -LOCATION = "" #e.g. us-central1 |
40 | | - |
41 | | -import vertexai |
42 | | -vertexai.init(project=PROJECT_ID, location=LOCATION) |
43 | | -``` |
44 | | - |
45 | | -### Vertex AI Workbench |
46 | | - |
47 | | -[Vertex AI Workbench](https://cloud.google.com/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. |
48 | | - |
49 | | -#### Creating your notebook instance on Vertex AI Workbench |
50 | | - |
51 | | -To create a new JupyterLab instance on Vertex AI Workbench, follow the [instructions here to create a user-managed notebooks instance](https://cloud.google.com/vertex-ai/docs/workbench/user-managed/create-new). |
52 | | - |
53 | | -#### Using this repository on Vertex AI Workbench |
54 | | - |
55 | | -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: |
56 | | - |
57 | | -```sh |
58 | | -git clone https://github.com/GoogleCloudPlatform/generative-ai.git |
59 | | -``` |
60 | | - |
61 | | -#### Local development |
62 | | - |
63 | | -- Install the [Google Cloud SDK](https://cloud.google.com/sdk). |
64 | | - |
65 | | -- Obtain authentication credentials. Create local credentials by running the following command and following the oauth2 flow (read more about the command [here](https://cloud.google.com/sdk/gcloud/reference/beta/auth/application-default/login)): |
66 | | - |
67 | | - ```bash |
68 | | - gcloud auth application-default login |
69 | | - ``` |
70 | | - |
71 | | -## Python library |
72 | | - |
73 | | -Install the latest Python SDK: |
74 | | - |
75 | | -```sh |
76 | | -%pip install google-cloud-aiplatform --upgrade |
77 | | -``` |
78 | | - |
79 | | -You will need to initialize `vertexai` with your `project_id` and `location`: |
80 | | - |
81 | | -```py |
82 | | -PROJECT_ID = "your-project-id" |
83 | | -LOCATION = "" #e.g. us-central1 |
84 | | - |
85 | | -import vertexai |
86 | | -vertexai.init(project=PROJECT_ID, location=LOCATION) |
87 | | -``` |
| 14 | +Following these instructions will ensure your environment is correctly configured to run the generative AI examples provided throughout this repository. |
0 commit comments