11
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Google Colabで学習済みモデルを保存する

Posted at

やりたいこと

  • Google Colabで学習させたモデルを、Googleドライブに保存する

手順

  • Google Driveを利用できるようにする
    • 以下を実行するとログイン画面に移動。ログインすると表示されるトークンを、入力するボックス(出てくる)に入力する
from google.colab import drive
drive.mount('/content/drive')
  • モデルを保存する
    • 右クリックで開かれるメニューからパスを取得できて便利
model.save("drive/My Drive/Colab Notebooks/sample/sample.h5")

保存したモデルを使用する

from tensorflow.keras.models import load_model
saved_model = load_model('/content/drive/My Drive/Colab Notebooks/sample/sample.h5')
11
9
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
11
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?