Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
TensorFlow 2.1云TPU v3 Pod的TPUClusterResolver出错_Tensorflow_Google Cloud Platform_Google Compute Engine_Google Cloud Tpu - Fatal编程技术网

TensorFlow 2.1云TPU v3 Pod的TPUClusterResolver出错

TensorFlow 2.1云TPU v3 Pod的TPUClusterResolver出错,tensorflow,google-cloud-platform,google-compute-engine,google-cloud-tpu,Tensorflow,Google Cloud Platform,Google Compute Engine,Google Cloud Tpu,我正试图在我的TensorFlow 2.1 Google云计算引擎VM上使用我的(可抢占的)云TPU v3-256,但它似乎不起作用,因为TPUClusterResolver抛出了一个无法查找TPU元数据的错误 只要我使用grpc://地址而不是TPU名称,使用单个(非可抢占)TPU就可以了。但是,当使用TPU名称时,单个TPU和我的TPU Pod都不起作用,并抛出此错误 有人能帮我解决这个问题吗 代码: 输出: ValueError: Could not lookup TPU metadata

我正试图在我的TensorFlow 2.1 Google云计算引擎VM上使用我的(可抢占的)云TPU v3-256,但它似乎不起作用,因为
TPUClusterResolver
抛出了一个
无法查找TPU元数据的
错误

只要我使用
grpc://
地址而不是TPU名称,使用单个(非可抢占)TPU就可以了。但是,当使用TPU名称时,单个TPU和我的TPU Pod都不起作用,并抛出此错误

有人能帮我解决这个问题吗

代码:

输出:

ValueError: Could not lookup TPU metadata from name 'my-tpu-name'. Please double
check the tpu argument in the TPUClusterResolver constructor.
Exception: Failed to retrieve http://metadata.google.internal/computeMetadata/v1/
instance/service-accounts/default/?recursive=True
from the Google Compute Enginemetadata service. Response: {'metadata-flavor': 'Google', 
'date': 'Thu, 28 May 2020 17:42:35 GMT', 'content-type': 'text/html; charset=UTF-8',
'server': 'Metadata Server for VM', 'content-length': '1629', 'x-xss-protection': '0', 'x
frame-options': 'SAMEORIGIN', 'status': '404'}

我怀疑这可能是以下任一方面的不匹配:ComputeVM和TPU之间的Tensorflow版本、区域或项目。 如果您使用相同的Tensorflow版本(2.1或2.2)创建TPU和GCE VM,并且它们都是在同一项目和区域中创建的。您只需在
TPUClusterResolver
中提供TPU名称,即可正常工作:

resolver = tf.distribute.cluster_resolver.TPUClusterResolver(tpu='my-tpu-name') 

如果在VM上设置环境变量(
export TPU\u name=my TPU name
),则可以省略TPU名称。

我怀疑API/客户端不支持TPU名称的结构。将其更改为超级简单的小写形式,无其他符号。类似“tpuxyz”的东西
resolver = tf.distribute.cluster_resolver.TPUClusterResolver(tpu='my-tpu-name')