【问题标题】:UnimplementedError while using TensoBoard with TPU将 TensoBoard 与 TPU 一起使用时出现 UnimplementedError
【发布时间】:2021-02-28 17:58:29
【问题描述】:

我目前正在使用 TPU 训练我的模型。不幸的是,在使用 TensoBoard 和 TPU 时出现 X 错误。如果我只使用 TPU,那么一切正常。如果我使用 GPU 和 TensorBoard,一切正常。我使用谷歌 colab。

%tensorflow_version 2.x
import tensorflow as tf
print("Tensorflow version " + tf.__version__)
TPU_ACTIVATED = True

if TPU_ACTIVATED:
  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)
.
.
.

SAVEPATH = "/content/drive/My Drive/checker/saved"
logdir = Path(SAVEPATH, "logs", datetime.datetime.now().strftime("%Y%m%d-%H%M%S"))
.
.
.
CALLBACKS = [tf.keras.callbacks.TensorBoard(logdir, histogram_freq=1)]
.
.
.
hist = model.fit(...,callbacks=CALLBACKS) # here is the error

错误:

UnimplementedError: File system scheme '[local]' not implemented (file: '/content/drive/My Drive/Dataset/checker/saved/logs/20201117-134736/train')
    Encountered when executing an operation using EagerExecutor. This error cancels all future operations and poisons their output tensors.

为什么会出现这个错误,我该如何解决?

【问题讨论】:

    标签: python tensorflow google-colaboratory tensorboard google-cloud-tpu


    【解决方案1】:

    TPU 只能直接从 GCS 目录读取/写入。您可以使用 GCS 存储桶并将其用作 logdir 吗?前任。 logdir='gs://GCS_BUCKET_NAME/...'

    另外,请确保您的 TPU 对您的 GCS 存储桶具有适当的写入权限:https://cloud.google.com/tpu/docs/storage-buckets#storage_access

    【讨论】:

      猜你喜欢
      • 2021-10-19
      • 2019-03-10
      • 2018-09-27
      • 2017-10-19
      • 2017-12-04
      • 2022-01-04
      • 2017-05-09
      • 1970-01-01
      • 2023-03-29
      相关资源
      最近更新 更多