LoginSignup
0
1

More than 3 years have passed since last update.

GCS にjupyterからモデルをアップロードする

Posted at

パッケージ

pip install --upgrade google-cloud-storage

サービスアカウント

jupyterが乗っているclusterのサービスアカウントに、ストレージ管理者渡す。

データの読み書き

# Imports the Google Cloud client library
from google.cloud import storage

project_name = "riita_project"
storage_client = storage.Client(project_name)

bucket_name = 'riita_bucket'
bucket = storage_client.get_bucket(bucket_name)

#ファイルをアップロード
blob = bucket.blob('保存ファイル名')
blob.upload_from_filename(filename='ローカルファイルパス')

#アップロードしたファイルをダウンロード
blob2 = bucket.get_blob('取得ファイル名')
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1