Autokeras: Support TPU

Created on 21 Oct 2018  路  5Comments  路  Source: keras-team/autokeras

bug report pinned

Most helpful comment

Looks like TPU is supported as KerasTuner now supports TPU, here is an example: https://colab.research.google.com/drive/1AaFDTQaq8B5p3-FKtNDdMdhlmUHtwOIM?authuser=1#scrollTo=HUJ0LxZnbQnc

and it's quite simple actually with only 2 lines of code:

resolver = tf.distribute.cluster_resolver.TPUClusterResolver(tpu=tpu_address)
strategy = tf.distribute.TPUStrategy(resolver)
clf = ak.ImageClassifier(max_trials=3, distribution_strategy=strategy)

Note: It looks like using with strategy.scope() will not work (same as KerasTuner) and the TPU strategy have to be passed down this way. I think it will be great if this is added somewhere in the documentation (I'm happy to contribute if needed), also thanks for the awesome package!

Edit: Actually there are some models generate that are not compatible with TPU will break, see the same colab above.

All 5 comments

@vincent-hui Yes, we are working on this issue.
Please refer to #105 .
Thanks.

@haifeng-jin so is there TPU support in Colab for AutoKeras? Or do we have to stick with GPU鈥檚?

This is a really old issue.
I expect we already support TPU,
but having some performance issues.
Should be solved when we support compile function for AutoModels.

If anyone is having any error caused by running AutoKeras on TPU.
Please paste it here.

Looks like TPU is supported as KerasTuner now supports TPU, here is an example: https://colab.research.google.com/drive/1AaFDTQaq8B5p3-FKtNDdMdhlmUHtwOIM?authuser=1#scrollTo=HUJ0LxZnbQnc

and it's quite simple actually with only 2 lines of code:

resolver = tf.distribute.cluster_resolver.TPUClusterResolver(tpu=tpu_address)
strategy = tf.distribute.TPUStrategy(resolver)
clf = ak.ImageClassifier(max_trials=3, distribution_strategy=strategy)

Note: It looks like using with strategy.scope() will not work (same as KerasTuner) and the TPU strategy have to be passed down this way. I think it will be great if this is added somewhere in the documentation (I'm happy to contribute if needed), also thanks for the awesome package!

Edit: Actually there are some models generate that are not compatible with TPU will break, see the same colab above.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xuzhang5788 picture xuzhang5788  路  4Comments

michelleowen picture michelleowen  路  6Comments

mlaradji picture mlaradji  路  4Comments

nectario picture nectario  路  5Comments

max1563 picture max1563  路  4Comments