No OpKernel was registered to support Op 'TPUReplicateMetadata' used by node TPUReplicateMetadata

Viewed 559

When I run the following .ipynb:

https://colab.research.google.com/drive/1DpUCBm58fruGNRtQL_DiSVbT90spdZgm

I got:

No OpKernel was registered to support Op 'TPUReplicateMetadata' used by node TPUReplicateMetadata (defined at /usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py:1748) with these attrs: [num_cores_per_replica=1, use_tpu=true, num_replicas=8, computation_shape=[], host_compute_core=[], device_assignment=[], _tpu_replicate="cluster", padding_map=[], topology="", step_marker_location="STEP_MARK_AT_ENTRY", allow_soft_placement=false] Registered devices: [CPU, XLA_CPU]

I have already asked this question in github: https://github.com/tensorflow/tensorflow/issues/33307

But the developer said it's not allowed to ask such question.

Much Thanks for your help~!

1 Answers

You should follow this tutorial: https://cloud.google.com/tpu/docs/quickstart (you have to create a GCP account) and set up a Cloud TPU. Then you have to click Runtime and set "TPU" as the hardware accelerator.

Finally you should add this code to your colab notebook:

import tensorflow as tf
import pprint

assert 'COLAB_TPU_ADDR' in os.environ, 'ERROR: Not connected to a TPU runtime; please see the first cell in this notebook for instructions!'
TPU_ADDRESS = 'grpc://' + os.environ['COLAB_TPU_ADDR']
print('TPU address is', TPU_ADDRESS)

from google.colab import auth
auth.authenticate_user()

with tf.compat.v1.Session(TPU_ADDRESS) as session:
  print('TPU devices:')
  pprint.pprint(session.list_devices())

  # Upload credentials to TPU.
  with open('/content/adc.json', 'r') as f:
    auth_info = json.load(f)
  tf.contrib.cloud.configure_gcs(session, credentials=auth_info)
  # Now credentials are set for all future sessions on this TPU.
Related