LoginSignup

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

More than 5 years have passed since last update.

AIoTLTハッカソン: Google ColaboratoryのGPUを使った学習

Posted at

使い始めるまで

Google Colaboratoryにアクセス

右下「Python3の新しいノートブック」を選択
スクリーンショット 2018-11-18 11.05.12.png

ランタイム > ランタイムのタイプを変更 を選択
スクリーンショット 2018-11-18 11.05.46.png

「ハードウェアアクセラレータ」を「GPU」に変更して保存
スクリーンショット 2018-11-18 11.06.07.png

セルをクリックし、下記のGPUがきちんと使えているかテストするコードを入力

import tensorflow as tf
tf.test.gpu_device_name()

「▷」で実行します
スクリーンショット 2018-11-18 11.08.36.png

"/device:GPU:0"が返れば成功

学習させる

「+コード」でセルを追加し、学習用のPythonコードを記述
スクリーンショット 2018-11-18 11.40.52.png

「▷」で実行(ローカルの10倍くらい早いらしい)

modelをローカルにダウンロード

model.save()files.download()で実行できます。

参照: Google Colaboratoryでmodelをsaveしてローカルに持ってくる方法(+アップロード方法)

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