|
187 | 187 | "if BUCKET_URI is None or BUCKET_URI.strip() == \"\" or BUCKET_URI == \"gs://\":\n", |
188 | 188 | " BUCKET_URI = f\"gs://{PROJECT_ID}-tmp-{now}-{str(uuid.uuid4())[:4]}\"\n", |
189 | 189 | " BUCKET_NAME = \"/\".join(BUCKET_URI.split(\"/\")[:3])\n", |
190 | | - " ! gcloud storage buckets create --location {REGION} {BUCKET_URI}\n", |
| 190 | + " ! gsutil mb -l {REGION} {BUCKET_URI\n", |
191 | 191 | "else:\n", |
192 | 192 | " assert BUCKET_URI.startswith(\"gs://\"), \"BUCKET_URI must start with `gs://`.\"\n", |
193 | | - " shell_output = ! gcloud storage ls --full --buckets {BUCKET_NAME} | grep \"Location Constraint:\" | sed \"s/Location Constraint://\"\n", |
| 193 | + " shell_output = ! gsutil ls -Lb {BUCKET_NAME} | grep \"Location constraint:\" | sed \"s/Location constraint://\"\n", |
194 | 194 | " bucket_region = shell_output[0].strip().lower()\n", |
195 | 195 | " if bucket_region != REGION:\n", |
196 | 196 | " raise ValueError(\n", |
|
215 | 215 | "\n", |
216 | 216 | "\n", |
217 | 217 | "# Provision permissions to the SERVICE_ACCOUNT with the GCS bucket\n", |
218 | | - "! gcloud storage buckets add-iam-policy-binding $BUCKET_NAME --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.admin\n", |
| 218 | + "! gsutil iam ch serviceAccount:{SERVICE_ACCOUNT}:roles/storage.admin $BUCKET_NAME\n", |
219 | 219 | "\n", |
220 | 220 | "! gcloud config set project $PROJECT_ID\n", |
221 | 221 | "! gcloud projects add-iam-policy-binding --no-user-output-enabled {PROJECT_ID} --member=serviceAccount:{SERVICE_ACCOUNT} --role=\"roles/storage.admin\"\n", |
|
335 | 335 | "if dataset_validation_util.is_gcs_path(pretrained_model_id):\n", |
336 | 336 | " # Download tokenizer.\n", |
337 | 337 | " ! mkdir tokenizer\n", |
338 | | - " ! gcloud storage cp {pretrained_model_id}/tokenizer.json ./tokenizer\n", |
339 | | - " ! gcloud storage cp {pretrained_model_id}/config.json ./tokenizer\n", |
| 338 | + " ! gsutil cp {pretrained_model_id}/tokenizer.json ./tokenizer\n", |
| 339 | + " ! gsutil cp {pretrained_model_id}/config.json ./tokenizer\n", |
340 | 340 | " tokenizer_path = \"./tokenizer\"\n", |
341 | 341 | " access_token = \"\"\n", |
342 | 342 | "else:\n", |
|
614 | 614 | "\n", |
615 | 615 | "# Find Vertex AI prediction supported accelerators and regions [here](https://cloud.google.com/vertex-ai/docs/predictions/configure-compute).\n", |
616 | 616 | "# @markdown Accelerator type to use for serving.\n", |
617 | | - "accelerator_type = (\n", |
618 | | - " \"NVIDIA_L4\" # @param [\"NVIDIA_L4\", \"NVIDIA_TESLA_V100\", \"NVIDIA_H100_80GB\"]\n", |
619 | | - ")\n", |
| 617 | + "accelerator_type = \"NVIDIA_L4\" # @param [\"NVIDIA_L4\", \"NVIDIA_TESLA_V100\", \"NVIDIA_H100_80GB\"]\n", |
620 | 618 | "\n", |
621 | 619 | "if accelerator_type == \"NVIDIA_L4\":\n", |
622 | 620 | " machine_type = \"g2-standard-96\"\n", |
|
899 | 897 | "\n", |
900 | 898 | "delete_bucket = False # @param {type:\"boolean\"}\n", |
901 | 899 | "if delete_bucket:\n", |
902 | | - " ! gcloud storage rm --recursive $BUCKET_NAME" |
| 900 | + " ! gsutil -m rm -r $BUCKET_NAME" |
903 | 901 | ] |
904 | 902 | } |
905 | 903 | ], |
|
0 commit comments