|
124 | 124 | "\n", |
125 | 125 | "# @markdown 3. For serving, **[click here](https://console.cloud.google.com/iam-admin/quotas?location=us-central1&metric=aiplatform.googleapis.com%2Fcustom_model_serving_nvidia_l4_gpus)** to check if your project already has the required 1 L4 GPU in the us-central1 region. If yes, then run this notebook in the us-central1 region. If you need more L4 GPUs for your project, then you can follow [these instructions](https://cloud.google.com/docs/quotas/view-manage#viewing_your_quota_console) to request more. Alternatively, if you want to run predictions with A100 80GB or H100 GPUs, we recommend using the regions listed below. **NOTE:** Make sure you have associated quota in selected regions. Click the links to see your current quota for each GPU type: [Nvidia A100 80GB](https://console.cloud.google.com/iam-admin/quotas?metric=aiplatform.googleapis.com%2Fcustom_model_serving_nvidia_a100_80gb_gpus), [Nvidia H100 80GB](https://console.cloud.google.com/iam-admin/quotas?metric=aiplatform.googleapis.com%2Fcustom_model_serving_nvidia_h100_gpus).\n", |
126 | 126 | "\n", |
127 | | - "# @markdown > | Machine Type | Accelerator Type | Recommended Regions |\n", |
| 127 | + "# @markdown > | Machin188e Type | Accelerator Type | Recommended Regions |\n", |
128 | 128 | "# @markdown | ----------- | ----------- | ----------- |\n", |
129 | 129 | "# @markdown | a2-ultragpu-1g | 1 NVIDIA_A100_80GB | us-central1, us-east4, europe-west4, asia-southeast1, us-east4 |\n", |
130 | 130 | "# @markdown | a3-highgpu-2g | 2 NVIDIA_H100_80GB | us-west1, asia-southeast1, europe-west4 |\n", |
|
185 | 185 | "if BUCKET_URI is None or BUCKET_URI.strip() == \"\" or BUCKET_URI == \"gs://\":\n", |
186 | 186 | " BUCKET_URI = f\"gs://{PROJECT_ID}-tmp-{now}-{str(uuid.uuid4())[:4]}\"\n", |
187 | 187 | " BUCKET_NAME = \"/\".join(BUCKET_URI.split(\"/\")[:3])\n", |
188 | | - " ! gcloud storage buckets create --location={REGION} {BUCKET_URI}\n", "else:\n", |
| 188 | + " ! gsutil mb -l {REGION} {BUCKET_URI}\n", |
| 189 | + "else:\n", |
189 | 190 | " assert BUCKET_URI.startswith(\"gs://\"), \"BUCKET_URI must start with `gs://`.\"\n", |
190 | | - " shell_output = ! gcloud storage ls --full --buckets {BUCKET_NAME} | grep \"Location constraint:\" | sed \"s/Location constraint://\"\n", " bucket_region = shell_output[0].strip().lower()\n", |
| 191 | + " shell_output = ! gsutil ls -b {BUCKET_NAME} | grep \"Location constraint:\" | sed \"s/Location constraint://\"\n", |
| 192 | + " bucket_region = shell_output[0].strip().lower()\n", |
191 | 193 | " if bucket_region != REGION:\n", |
192 | 194 | " raise ValueError(\n", |
193 | 195 | " \"Bucket region %s is different from notebook region %s\"\n", |
|
211 | 213 | "\n", |
212 | 214 | "\n", |
213 | 215 | "# Provision permissions to the SERVICE_ACCOUNT with the GCS bucket\n", |
214 | | - "! gcloud storage buckets add-iam-policy-binding $BUCKET_NAME --member=\"serviceAccount:{SERVICE_ACCOUNT}\" --role=\"roles/storage.admin\"\n", "\n", |
| 216 | + "! gcloud projects add-iam-policy-binding --no-user-output-enabled {PROJECT_ID} --member=serviceAccount:{SERVICE_ACCOUNT} --role=\"roles/storage.admin\"\n", |
| 217 | + "\n", |
215 | 218 | "! gcloud config set project $PROJECT_ID\n", |
216 | 219 | "! gcloud projects add-iam-policy-binding --no-user-output-enabled {PROJECT_ID} --member=serviceAccount:{SERVICE_ACCOUNT} --role=\"roles/storage.admin\"\n", |
217 | 220 | "! gcloud projects add-iam-policy-binding --no-user-output-enabled {PROJECT_ID} --member=serviceAccount:{SERVICE_ACCOUNT} --role=\"roles/aiplatform.user\"" |
|
392 | 395 | "if dataset_validation_util.is_gcs_path(pretrained_model_id):\n", |
393 | 396 | " # Download tokenizer.\n", |
394 | 397 | " ! mkdir tokenizer\n", |
395 | | - " ! gcloud storage cp {pretrained_model_id}/tokenizer.json ./tokenizer\n", " ! gcloud storage cp {pretrained_model_id}/config.json ./tokenizer\n", " tokenizer_path = \"./tokenizer\"\n", |
| 398 | + " ! gsutil -m cp {pretrained_model_id}/tokenizer.json ./tokenizer\n", |
| 399 | + " ! gsutil -m cp {pretrained_model_id}/config.json ./tokenizer\n", |
| 400 | + " tokenizer_path = \"./tokenizer\"\n", |
396 | 401 | " access_token = \"\"\n", |
397 | 402 | "else:\n", |
398 | 403 | " tokenizer_path = pretrained_model_id\n", |
|
1079 | 1084 | "\n", |
1080 | 1085 | "delete_bucket = False # @param {type:\"boolean\"}\n", |
1081 | 1086 | "if delete_bucket:\n", |
1082 | | - " ! gcloud storage rm --recursive $BUCKET_NAME" ] |
| 1087 | + " ! gsutil rm -r $BUCKET_NAME" ] |
1083 | 1088 | } |
1084 | 1089 | ], |
1085 | 1090 | "metadata": { |
|
0 commit comments