0
  1. Scripts in Tensorflow 1.X,but it's still not working in Tensorflow 2.0

2.How can I migrate this scipts to Tensorflow 2.0


import datetime
import json
import os
import pprint
import random
import string
import sys
import tensorflow as tf
import tensorflow_io as tfio

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.
  • **I get this error**:---tensorflow:InvalidArgumentError: Error executing an HTTP request: HTTP response code 400 with body '{ "error": { "code": 400, "message": "Bucket is requester pays bucket but no user project provided.", "errors": [ { "message": "Bucket is requester pays bucket but no user project provided.", "domain": "global", "reason": "required" } ] } } ' when reading metadata of gs://nq-competition//checkpoint – jim_care Jan 17 '20 at 06:52
  • I had this issue and this helped me https://stackoverflow.com/questions/61448884/how-to-connect-to-private-storage-bucket-using-the-google-colab-tpu though I am now running into a different issue – SantoshGupta7 Jun 28 '20 at 07:00

0 Answers0