huan / tensorflow-handbook-tpu

TensorFlow 2 Handbook for TPU on Google Cloud
https://tf.wiki/zh/appendix/tpu.html
Apache License 2.0
17 stars 5 forks source link

Colab TPU sample not match the doc #2

Closed Duan-JM closed 4 years ago

Duan-JM commented 4 years ago

Maybe there is a little typo in the online doc, I think cluster_resolver is the right version. I have tested it by TensorFlow 1.15, so for cluster_resolver is good to go for me.

# In online doc https://tf.wiki/zh/appendix/tpu.html
resolver = tf.distribute.resolver.TPUClusterResolver(tpu='grpc://' + os.environ['COLAB_TPU_ADDR'])

# On Colab TPU Example
resolver = tf.distribute.cluster_resolver.TPUClusterResolver(tpu='grpc://' + os.environ['COLAB_TPU_ADDR'])
huan commented 4 years ago

We are targeting the TF2.0 or above.

Cloud you please confirm this case is the same for the TF2.0?

Duan-JM commented 4 years ago

Sorry for unclear expression, I have tested on both tf2.0 and tf1.0. The online TPU Colab example using tf.distribute.cluster_resolver, however tf.distribute.resolver in the doc.

I tested it by using %tensorflow_version 2.xto switch between tf2.0 and tf1.15, and my Colab can be found here

huan commented 4 years ago

Close this issue because TPU works like a charm on Colab now!