Switch branches/tags
Nothing to show
Find file History
Latest commit fbb40b5 Sep 27, 2018
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
__init__.py lessson 11- google colab tut added Sep 27, 2018
colab_gpu.py lessson 11- google colab tut added Sep 27, 2018
colab_simple.py lessson 11- google colab tut added Sep 27, 2018
colab_tpu.py lessson 11- google colab tut added Sep 27, 2018
readme.md Update readme.md Sep 27, 2018

readme.md

Google Colab Tutorial


First of all select what kinds of hardware accelerator you want in Edit-> Notebook Settings.

Use TPU in Colab


After selecting tpu in Notebook settings, add few extra lines:

  1. Enable TPU accelerator in Edit->Notebook Settings.

  2. Add TPU_WORKER = 'grpc://' + os.environ['COLAB_TPU_ADDR'] at the beginning of the file.

  3. Convert your keras model into TPU model with keras_to_tpu_model function:

    strategy = tf.contrib.tpu.TPUDistributionStrategy(tf.contrib.cluster_resolver.TPUClusterResolver(TPU_WORKER)) model = tf.contrib.tpu.keras_to_tpu_model(model, strategy=strategy)

See complete example colab_tpu.py