这是indexloc提供的服务,不要输入任何密码
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -721,12 +721,10 @@
"else:\n",
" FILE = IMPORT_FILE\n",
"\n",
"count = ! gsutil cat $FILE | wc -l\n",
"print(\"Number of Examples\", int(count[0]))\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" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1342,8 +1340,7 @@
},
"outputs": [],
"source": [
"test_item = !gsutil cat $IMPORT_FILE | head -n1\n",
"if len(str(test_item[0]).split(\",\")) == 3:\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",
" test_item, test_label = str(test_item[0]).split(\",\")\n",
Expand Down Expand Up @@ -1568,8 +1565,7 @@
" print(e)\n",
"\n",
"if delete_bucket and \"BUCKET_NAME\" in globals():\n",
" ! gsutil rm -r $BUCKET_NAME"
]
" ! gcloud storage rm --recursive $BUCKET_NAME" ]
}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -726,12 +726,10 @@
"else:\n",
" FILE = IMPORT_FILE\n",
"\n",
"count = ! gsutil cat $FILE | wc -l\n",
"print(\"Number of Examples\", int(count[0]))\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" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1338,8 +1336,7 @@
"source": [
"import json\n",
"\n",
"test_items = !gsutil cat $IMPORT_FILE | head -n1\n",
"test_data = test_items[0].replace(\"'\", '\"')\n",
"test_items = !gcloud storage cat $IMPORT_FILE | head -n1\n", "test_data = test_items[0].replace(\"'\", '\"')\n",
"test_data = json.loads(test_data)\n",
"try:\n",
" test_item = test_data[\"image_gcs_uri\"]\n",
Expand Down Expand Up @@ -1555,8 +1552,7 @@
" print(e)\n",
"\n",
"if delete_bucket and \"BUCKET_NAME\" in globals():\n",
" ! gsutil rm -r $BUCKET_NAME"
]
" ! gcloud storage rm --recursive $BUCKET_NAME" ]
}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,12 +723,10 @@
"else:\n",
" FILE = IMPORT_FILE\n",
"\n",
"count = ! gsutil cat $FILE | wc -l\n",
"print(\"Number of Examples\", int(count[0]))\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" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1544,8 +1542,7 @@
" print(e)\n",
"\n",
"if delete_bucket and \"BUCKET_NAME\" in globals():\n",
" ! gsutil rm -r $BUCKET_NAME"
]
" ! gcloud storage rm --recursive $BUCKET_NAME" ]
}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION -p $PROJECT_ID $BUCKET_NAME"
]
"! gcloud storage buckets create --location=$REGION --project=$PROJECT_ID $BUCKET_NAME" ]
},
{
"cell_type": "markdown",
Expand All @@ -497,8 +496,7 @@
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_NAME"
]
"! gcloud storage ls --all-versions --long $BUCKET_NAME" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -579,8 +577,7 @@
},
"outputs": [],
"source": [
"! gsutil cp gs://cloud-samples-data/vertex-ai/matching_engine/glove-100-angular.hdf5 ."
]
"! gcloud storage cp gs://cloud-samples-data/vertex-ai/matching_engine/glove-100-angular.hdf5 ." ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -661,8 +658,7 @@
"source": [
"# NOTE: Everything in this Google Cloud Storage directory will be DELETED before uploading the data\n",
"\n",
"! gsutil rm -raf {BUCKET_NAME}/** 2> /dev/null || true"
]
"! gcloud storage rm --recursive --all-versions --continue-on-error {BUCKET_NAME}/** 2> /dev/null || true" ]
},
{
"cell_type": "code",
Expand All @@ -672,8 +668,7 @@
},
"outputs": [],
"source": [
"! gsutil cp glove100.json {BUCKET_NAME}/glove100.json"
]
"! gcloud storage cp glove100.json {BUCKET_NAME}/glove100.json" ]
},
{
"cell_type": "code",
Expand All @@ -683,8 +678,7 @@
},
"outputs": [],
"source": [
"! gsutil ls {BUCKET_NAME}"
]
"! gcloud storage ls {BUCKET_NAME}" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -966,8 +960,7 @@
},
"outputs": [],
"source": [
"! gsutil cp glove100_incremental.json {BUCKET_NAME}/incremental/glove100.json"
]
"! gcloud storage cp glove100_incremental.json {BUCKET_NAME}/incremental/glove100.json" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -2049,8 +2042,7 @@
"\n",
"delete_bucket = False\n",
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
" ! gsutil -m rm -r $BUCKET_NAME"
]
" ! gcloud storage rm --recursive $BUCKET_NAME" ]
}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION gs://$BUCKET_NAME"
]
"! gcloud storage buckets create --location $REGION gs://$BUCKET_NAME" ]
},
{
"cell_type": "markdown",
Expand All @@ -345,8 +344,7 @@
},
"outputs": [],
"source": [
"! gsutil ls -al gs://$BUCKET_NAME"
]
"! gcloud storage ls --all-versions --long gs://$BUCKET_NAME" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -542,8 +540,7 @@
},
"outputs": [],
"source": [
"! gsutil cat $IMPORT_FILE | head -n 10"
]
"! gcloud storage cat $IMPORT_FILE | head -n 10" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1435,8 +1432,7 @@
},
"outputs": [],
"source": [
"test_items = ! gsutil cat $IMPORT_FILE | head -n2\n",
"\n",
"test_items = ! gcloud storage cat $IMPORT_FILE | head -n2\n", "\n",
"cols = str(test_items[0]).split(\",\")\n",
"test_item_1 = str(cols[0])\n",
"test_label_1 = str(cols[1])\n",
Expand Down Expand Up @@ -1510,8 +1506,7 @@
"\n",
"print(gcs_input_uri)\n",
"\n",
"!gsutil cat $gcs_input_uri"
]
"!gcloud storage cat $gcs_input_uri" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1842,8 +1837,7 @@
"source": [
"def get_latest_predictions(gcs_out_dir):\n",
" \"\"\" Get the latest prediction subfolder using the timestamp in the subfolder name\"\"\"\n",
" folders = !gsutil ls $gcs_out_dir\n",
" latest = \"\"\n",
" folders = !gcloud storage ls $gcs_out_dir\n", " latest = \"\"\n",
" for folder in folders:\n",
" subfolder = folder.split(\"/\")[-2]\n",
" if subfolder.startswith(\"prediction-\"):\n",
Expand All @@ -1862,10 +1856,8 @@
" folder = get_latest_predictions(\n",
" response.output_config.gcs_destination.output_uri_prefix\n",
" )\n",
" ! gsutil ls $folder/prediction*.jsonl\n",
"\n",
" ! gsutil cat $folder/prediction*.jsonl\n",
" break\n",
" ! gcloud storage ls $folder/prediction*.jsonl\n", "\n",
" ! gcloud storage cat $folder/prediction*.jsonl\n", " break\n",
" time.sleep(60)"
]
},
Expand Down Expand Up @@ -1941,8 +1933,7 @@
" print(e)\n",
"\n",
"if delete_bucket and \"BUCKET_NAME\" in globals():\n",
" ! gsutil rm -r gs://$BUCKET_NAME"
]
" ! gcloud storage rm --recursive gs://$BUCKET_NAME" ]
}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION $BUCKET_URI"
]
"! gcloud storage buckets create --location=$REGION $BUCKET_URI" ]
},
{
"cell_type": "markdown",
Expand All @@ -509,8 +508,7 @@
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_URI"
]
"! gcloud storage ls --all-versions --long $BUCKET_URI" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1300,14 +1298,12 @@
"\n",
"! bq --location=us extract --destination_format CSV $BQ_PROJECT_DATASET_TABLE $BUCKET_URI/mydata*.csv\n",
"\n",
"IMPORT_FILES = ! gsutil ls $BUCKET_URI/mydata*.csv\n",
"\n",
"IMPORT_FILES = ! gcloud storage ls $BUCKET_URI/mydata*.csv\n", "\n",
"print(IMPORT_FILES)\n",
"\n",
"EXAMPLE_FILE = IMPORT_FILES[0]\n",
"\n",
"! gsutil cat $EXAMPLE_FILE | head"
]
"! gcloud storage cat $EXAMPLE_FILE | head" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1453,8 +1449,7 @@
"EXPORTED_DIR = f\"{BUCKET_URI}/exported\"\n",
"exported_files = dataset.export_data(output_dir=EXPORTED_DIR)\n",
"\n",
"! gsutil ls $EXPORTED_DIR"
]
"! gcloud storage ls $EXPORTED_DIR" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1483,8 +1478,7 @@
"source": [
"jsonl_index = exported_files[0]\n",
"\n",
"! gsutil cat $jsonl_index | head"
]
"! gcloud storage cat $jsonl_index | head" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1695,8 +1689,7 @@
" if n % 10 == 0:\n",
" print(n, image)\n",
"\n",
"listing = ! gsutil ls -la $GCS_TFRECORD_URI\n",
"print(\"TFRecord File\", listing)"
"listing = ! gcloud storage ls --long --all-versions $GCS_TFRECORD_URI\n", "print(\"TFRecord File\", listing)"
]
},
{
Expand Down Expand Up @@ -1733,8 +1726,7 @@
"\n",
"# Delete the bucket\n",
"if delete_bucket or os.getenv(\"IS_TESTING\"):\n",
" ! gsutil rm -r $BUCKET_URI"
]
" ! gcloud storage rm --recursive $BUCKET_URI" ]
}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,7 @@
},
"outputs": [],
"source": [
"! gsutil mb -l $REGION $BUCKET_NAME"
]
"! gcloud storage buckets create --location=$REGION $BUCKET_NAME" ]
},
{
"cell_type": "markdown",
Expand All @@ -495,8 +494,7 @@
},
"outputs": [],
"source": [
"! gsutil ls -al $BUCKET_NAME"
]
"! gcloud storage ls --all-versions --long $BUCKET_NAME" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1057,8 +1055,7 @@
"! rm -f custom.tar custom.tar.gz\n",
"! tar cvf custom.tar custom\n",
"! gzip custom.tar\n",
"! gsutil cp custom.tar.gz $BUCKET_NAME/trainer_cifar10.tar.gz"
]
"! gcloud storage cp custom.tar.gz $BUCKET_NAME/trainer_cifar10.tar.gz" ]
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -1679,8 +1676,7 @@
" print(e)\n",
"\n",
" if \"BUCKET_NAME\" in globals():\n",
" ! gsutil rm -r $BUCKET_NAME"
]
" ! gcloud storage rm --recursive $BUCKET_NAME" ]
}
],
"metadata": {
Expand Down
Loading
Loading