diff --git a/notebooks/official/automl/automl_image_classification_online_prediction.ipynb b/notebooks/official/automl/automl_image_classification_online_prediction.ipynb index ab9bf359d..5aca9847c 100644 --- a/notebooks/official/automl/automl_image_classification_online_prediction.ipynb +++ b/notebooks/official/automl/automl_image_classification_online_prediction.ipynb @@ -280,7 +280,7 @@ }, "outputs": [], "source": [ - "! gsutil mb -l $LOCATION -p $PROJECT_ID $BUCKET_URI" + "! gcloud storage buckets create --location=$LOCATION --project=$PROJECT_ID $BUCKET_URI" ] }, { @@ -387,11 +387,11 @@ "else:\n", " FILE = IMPORT_FILE\n", "\n", - "count = ! gsutil cat $FILE | wc -l\n", + "count = ! gcloud storage cat $FILE | wc -l\n", "print(\"Number of Examples\", int(count[0]))\n", "\n", "print(\"First 10 rows\")\n", - "! gsutil cat $FILE | head" + "! gcloud storage cat $FILE | head" ] }, { @@ -597,7 +597,7 @@ }, "outputs": [], "source": [ - "test_item = !gsutil cat $IMPORT_FILE | head -n1\n", + "test_item = !gcloud storage cat $IMPORT_FILE | head -n1\n", "if len(str(test_item[0]).split(\",\")) == 3:\n", " _, test_item, test_label = str(test_item[0]).split(\",\")\n", "else:\n", @@ -718,7 +718,7 @@ "# Delete Cloud Storage objects that were created\n", "delete_bucket = False # Set True for deletion\n", "if delete_bucket:\n", - " ! gsutil -m rm -r $BUCKET_URI" + " ! gcloud storage rm --recursive $BUCKET_URI" ] } ], diff --git a/notebooks/official/generative_ai/tune_peft.ipynb b/notebooks/official/generative_ai/tune_peft.ipynb index cb1b9ef62..a4b03f5fb 100644 --- a/notebooks/official/generative_ai/tune_peft.ipynb +++ b/notebooks/official/generative_ai/tune_peft.ipynb @@ -286,7 +286,7 @@ }, "outputs": [], "source": [ - "! gsutil mb -l {LOCATION} -p {PROJECT_ID} {BUCKET_URI}" + "! gcloud storage buckets create --location={LOCATION} --project={PROJECT_ID} {BUCKET_URI}" ] }, { @@ -359,9 +359,9 @@ }, "outputs": [], "source": [ - "! gsutil iam ch serviceAccount:{SERVICE_ACCOUNT}:roles/storage.objectCreator $BUCKET_URI\n", + "! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectCreator\n", "\n", - "! gsutil iam ch serviceAccount:{SERVICE_ACCOUNT}:roles/storage.objectViewer $BUCKET_URI" + "! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectViewer\n" ] }, { @@ -464,8 +464,8 @@ "outputs": [], "source": [ "# Download dataset\n", - "! gsutil cp gs://cloud-samples-data/vertex-ai/model-evaluation/peft_eval_sample.jsonl {BUCKET_URI}/peft_eval_sample.jsonl\n", - "! gsutil cp gs://cloud-samples-data/vertex-ai/model-evaluation/peft_train_sample.jsonl {BUCKET_URI}/peft_train_sample.jsonl" + "! gcloud storage cp gs://cloud-samples-data/vertex-ai/model-evaluation/peft_eval_sample.jsonl {BUCKET_URI}/peft_eval_sample.jsonl\n", + "! gcloud storage cp gs://cloud-samples-data/vertex-ai/model-evaluation/peft_train_sample.jsonl {BUCKET_URI}/peft_train_sample.jsonl" ] }, { @@ -662,7 +662,7 @@ "# Delete bucket\n", "delete_bucket = True\n", "if delete_bucket:\n", - " ! gsutil rm -rf {BUCKET_URI}" + " ! gcloud storage rm --recursive --continue-on-error {BUCKET_URI}" ] } ], diff --git a/notebooks/official/pipelines/google_cloud_pipeline_components_automl_images.ipynb b/notebooks/official/pipelines/google_cloud_pipeline_components_automl_images.ipynb index ecf72bdc8..32b118c40 100644 --- a/notebooks/official/pipelines/google_cloud_pipeline_components_automl_images.ipynb +++ b/notebooks/official/pipelines/google_cloud_pipeline_components_automl_images.ipynb @@ -330,7 +330,7 @@ }, "outputs": [], "source": [ - "! gsutil mb -l {LOCATION} {BUCKET_URI}" + "! gcloud storage buckets create --location={LOCATION} {BUCKET_URI}" ] }, { @@ -403,9 +403,9 @@ }, "outputs": [], "source": [ - "! gsutil iam ch serviceAccount:{SERVICE_ACCOUNT}:roles/storage.objectCreator $BUCKET_URI\n", + "! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectCreator\n", "\n", - "! gsutil iam ch serviceAccount:{SERVICE_ACCOUNT}:roles/storage.objectViewer $BUCKET_URI" + "! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectViewer" ] }, { @@ -707,7 +707,7 @@ "delete_bucket = False\n", "\n", "if delete_bucket:\n", - " ! gsutil rm -r $BUCKET_URI" + " ! gcloud storage rm --recursive $BUCKET_URI" ] } ], diff --git a/notebooks/official/pipelines/google_cloud_pipeline_components_automl_tabular.ipynb b/notebooks/official/pipelines/google_cloud_pipeline_components_automl_tabular.ipynb index 88a5ea398..997346628 100644 --- a/notebooks/official/pipelines/google_cloud_pipeline_components_automl_tabular.ipynb +++ b/notebooks/official/pipelines/google_cloud_pipeline_components_automl_tabular.ipynb @@ -325,7 +325,7 @@ }, "outputs": [], "source": [ - "! gsutil mb -l {LOCATION} -p {PROJECT_ID} {BUCKET_URI}" + "! gcloud storage buckets create --location={LOCATION} --project={PROJECT_ID} {BUCKET_URI}" ] }, { @@ -399,9 +399,9 @@ }, "outputs": [], "source": [ - "! gsutil iam ch serviceAccount:{SERVICE_ACCOUNT}:roles/storage.objectCreator $BUCKET_URI\n", + "! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectCreator\n", "\n", - "! gsutil iam ch serviceAccount:{SERVICE_ACCOUNT}:roles/storage.objectViewer $BUCKET_URI" + "! gcloud storage buckets add-iam-policy-binding $BUCKET_URI --member=serviceAccount:{SERVICE_ACCOUNT} --role=roles/storage.objectViewer\n" ] }, { @@ -492,7 +492,7 @@ "outputs": [], "source": [ "TRAIN_FILE_NAME = \"california_housing_train.csv\"\n", - "! gsutil cp gs://cloud-samples-data/vertex-ai/pipeline-deployment/datasets/california_housing/california_housing_train.csv {PIPELINE_ROOT}/data/\n", + "! gcloud storage cp gs://cloud-samples-data/vertex-ai/pipeline-deployment/datasets/california_housing/california_housing_train.csv {PIPELINE_ROOT}/data/\n", "\n", "gcs_csv_path = f\"{PIPELINE_ROOT}/data/{TRAIN_FILE_NAME}\"\n", "\n", @@ -682,7 +682,7 @@ "\n", "\n", "if delete_bucket:\n", - " ! gsutil rm -r $BUCKET_URI" + " ! gcloud storage rm --recursive $BUCKET_URI" ] } ], diff --git a/notebooks/official/prediction/get_started_with_raw_predict.ipynb b/notebooks/official/prediction/get_started_with_raw_predict.ipynb index 5667ef3b2..141d46907 100644 --- a/notebooks/official/prediction/get_started_with_raw_predict.ipynb +++ b/notebooks/official/prediction/get_started_with_raw_predict.ipynb @@ -286,7 +286,7 @@ }, "outputs": [], "source": [ - "! gsutil mb -l {LOCATION} -p {PROJECT_ID} {BUCKET_URI}" + "! gcloud storage buckets create --location={LOCATION} --project={PROJECT_ID} {BUCKET_URI}" ] }, { @@ -439,7 +439,7 @@ "source": [ "MODEL_DIR = BUCKET_URI + \"/model\"\n", "\n", - "! gsutil cp -r gs://cloud-samples-data/vertex-ai/google-cloud-aiplatform-ci-artifacts/models/penguins/estimator/ {MODEL_DIR}" + "! gcloud storage cp --recursive gs://cloud-samples-data/vertex-ai/google-cloud-aiplatform-ci-artifacts/models/penguins/estimator/ {MODEL_DIR}" ] }, { @@ -681,7 +681,7 @@ " print(e)\n", "\n", "if delete_bucket:\n", - " ! gsutil rm -rf {BUCKET_URI}" + " ! gcloud storage rm --recursive --continue-on-error {BUCKET_URI}" ] } ],