|
461 | 461 | "temp_dir = tempfile.TemporaryDirectory()\n", |
462 | 462 | "local_metrics_path = os.path.join(temp_dir.name, metrics_file_name)\n", |
463 | 463 | "\n", |
464 | | - "! gcloud storage cp $metrics_path $local_metrics_path\n", |
| 464 | + "! gsutil cp $metrics_path $local_metrics_path\n", |
465 | 465 | "\n", |
466 | 466 | "steps = []\n", |
467 | 467 | "training_losses = []\n", |
468 | | - "with open(local_metrics_path) as f:\n", |
| 468 | + "with open(local_metrics_path, \"r\") as f:\n", |
469 | 469 | " for line in f:\n", |
470 | 470 | " metric = json.loads(line)\n", |
471 | 471 | " steps.append(metric[\"step\"])\n", |
|
507 | 507 | "\n", |
508 | 508 | "local_last_checkpoint_path = os.path.join(temp_dir.name, last_checkpoint_file_name)\n", |
509 | 509 | "\n", |
510 | | - "! gcloud storage cp $last_checkpoint_path $local_last_checkpoint_path\n", |
| 510 | + "! gsutil cp $last_checkpoint_path $local_last_checkpoint_path\n", |
511 | 511 | "\n", |
512 | | - "with open(local_last_checkpoint_path) as f:\n", |
| 512 | + "with open(local_last_checkpoint_path, \"r\") as f:\n", |
513 | 513 | " final_checkpoint_name = \"checkpoint.bv-\" + f.read()\n", |
514 | 514 | " checkpoint_path = os.path.join(finetune_output_dir, final_checkpoint_name)\n", |
515 | 515 | "\n", |
|
633 | 633 | "\n", |
634 | 634 | "# @markdown <img src=\"https://storage.googleapis.com/longcap100/91.jpeg\" width=\"400\" >\n", |
635 | 635 | "\n", |
636 | | - "image_url = (\n", |
637 | | - " \"https://storage.googleapis.com/longcap100/91.jpeg\" # @param {type:\"string\"}\n", |
638 | | - ")\n", |
| 636 | + "image_url = \"https://storage.googleapis.com/longcap100/91.jpeg\" # @param {type:\"string\"}\n", |
639 | 637 | "\n", |
640 | 638 | "language_code = \"en\" # @param {type: \"string\"}\n", |
641 | 639 | "\n", |
|
695 | 693 | "\n", |
696 | 694 | "delete_bucket = False # @param {type:\"boolean\"}\n", |
697 | 695 | "if delete_bucket:\n", |
698 | | - " ! gcloud storage rm --recursive $BUCKET_NAME" |
| 696 | + " ! gsutil -m rm -r $BUCKET_NAME" |
699 | 697 | ] |
700 | 698 | } |
701 | 699 | ], |
|
0 commit comments