【发布时间】:2021-02-17 21:46:52
【问题描述】:
我目前正在 TPU 的帮助下训练神经网络。 我更改了运行时类型并初始化了 TPU。 我感觉它仍然没有更快。我用https://www.tensorflow.org/guide/tpu。 我有什么问题吗?
# TPU initialization
resolver = tf.distribute.cluster_resolver.TPUClusterResolver(tpu='grpc://' + os.environ['COLAB_TPU_ADDR'])
tf.config.experimental_connect_to_cluster(resolver)
# This is the TPU initialization code that has to be at the beginning.
tf.tpu.experimental.initialize_tpu_system(resolver)
print("All devices: ", tf.config.list_logical_devices('TPU'))
.
.
.
# experimental_steps_per_execution = 50
model.compile(optimizer=Adam(lr=learning_rate), loss='binary_crossentropy', metrics=['accuracy'], experimental_steps_per_execution = 50)
我的模型总结
我还有什么需要考虑或调整的吗?
【问题讨论】:
标签: python tensorflow google-colaboratory tpu