首页 > 解决方案 > 在 Google Colab Pro 中使用 TPU v3

问题描述

有没有办法在 Google Colab Pro 中使用 TPU v3 而不是 TPU v2?

不幸的是,我收到 TPU v2 的错误消息Compilation failure: Ran out of memory in memory space hbm. Used 8.29G of 7.48G hbm. Exceeded hbm capacity by 825.60M.,而 TPU v3 不再收到该消息。因为 TPU v3 有更多的内存。

有谁知道一种可能性/选择?

有了这个我开始TPU

try:
  tpu = tf.distribute.cluster_resolver.TPUClusterResolver()  # TPU detection
  print('Running on TPU ', tpu.cluster_spec().as_dict()['worker'])
except ValueError:
  raise BaseException('ERROR: Not connected to a TPU runtime; please see the previous cell in this notebook for instructions!')


tf.config.experimental_connect_to_cluster(tpu)
tf.tpu.experimental.initialize_tpu_system(tpu)
#tpu_strategy = tf.distribute.experimental.TPUStrategy(tpu)
strategy = tf.distribute.TPUStrategy(tpu)

标签: pythontensorflowgoogle-cloud-tpugoogle-colaboratory

解决方案


简短的回答是否定的。无法指定您想要的特定 TPU 版本。虽然我相信 Kaggle 提供了 v3-8 TPU(由于它是免费的,因此它也可能会发生变化)。此外,正如另一个答案指出的那样,您也可以自己启动付费的 Cloud TPU,您可以为其指定特定的硬件。


推荐阅读