Google colaboratory 如何在Tensorflow 2.0中使用Google Colab TPU将检查点保存到Google云存储? Tensorflow 1.X中的脚本,但它在Tensorflow 2.0中仍然不起作用
2.如何将此scipts迁移到Tensorflow 2.0Google colaboratory 如何在Tensorflow 2.0中使用Google Colab TPU将检查点保存到Google云存储? Tensorflow 1.X中的脚本,但它在Tensorflow 2.0中仍然不起作用,google-colaboratory,tensorflow2.0,tpu,Google Colaboratory,Tensorflow2.0,Tpu,2.如何将此scipts迁移到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 runt
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.
我得到这个错误:----tensorflow:InvalidArgumentError:执行HTTP请求时出错:HTTP响应代码400,正文为“{”错误“{”代码:400,消息“:“Bucket是请求者支付的Bucket,但没有提供用户项目。”,“errors:[{”消息“:“Bucket是请求者支付的Bucket,但没有提供用户项目。”,“域”:“全局”,“原因”:“必需”}]}}在阅读gs://nq competition//Checkpoint的元数据时,我遇到了这个问题,这对我有所帮助,尽管我现在遇到了另一个问题