python - 在 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)
解决方案
简短的回答是否定的。无法指定您想要的特定 TPU 版本。虽然我相信 Kaggle 提供了 v3-8 TPU(由于它是免费的,因此它也可能会发生变化)。此外,正如另一个答案指出的那样,您也可以自己启动付费的 Cloud TPU,您可以为其指定特定的硬件。
推荐阅读
- ansible - 从名称值为“PROD_poolgroup”的 JSON 中提取“members”值的语法是什么
- javascript - 如何限制 javascript 函数最大运行。每天1次
- java - 重建官方 docker 镜像的 AdoptOpenJDK 策略是什么?
- ios - 使用 .dataRepresentation() 为 UIActivityViewController 加载 PDF 问题
- html - 调整窗口大小时如何使所有元素移动
- bash - bash:IFS 在临时更改它以进行数组构建后“卡住”
- firebase - Firebase 托管重写为外部 url
- reactjs - 如何从 react-jsonschema-form 库在 React 应用程序中显示表单组件?'JSONSchemaForm' 未定义 no-undef
- node.js - 模式中不存在的 Gatsby `S3Object`。在添加解析器之前使用`createTypes`添加类型
- html - Flask 模板不刷新,样式不适用