问题描述
我正在尝试使用Pytorch / XLA运行GCP TPU,我正在使用带有debian-9-torch-xla-v20200818映像的VM,我启动了TPU并使用ctpu状态检查它是否正在运行,这表明两个cpu和TPU正在运行,然后我激活了Torch-xla-nightly环境,但是当我尝试调用此简单代码时:
import torch
import torch_xla
import torch_xla.core.xla_model as xm
dev = xm.xla_device()
t1 = torch.ones(3,3,device = dev)
print(t1)
出现此错误:
Traceback (most recent call last):
File "<stdin>",line 1,in <module>
File "/anaconda3/envs/torch-xla-nightly/lib/python3.6/site-packages/torch_xla/core/xla_model.py",line 231,in xla_device
devkind=devkind if devkind is not None else None)
File "/anaconda3/envs/torch-xla-nightly/lib/python3.6/site-packages/torch_xla/core/xla_model.py",line 136,in get_xla_supported_devices
xla_devices = _DEVICES.value
File "/anaconda3/envs/torch-xla-nightly/lib/python3.6/site-packages/torch_xla/utils/utils.py",line 32,in value
self._value = self._gen_fn()
File "/anaconda3/envs/torch-xla-nightly/lib/python3.6/site-packages/torch_xla/core/xla_model.py",line 18,in <lambda>
_DEVICES = xu.LazyProperty(lambda: torch_xla._XLAC._xla_get_devices())
RuntimeError: tensorflow/compiler/xla/xla_client/computation_client.cc:274 : Missing XLA configuration
我尝试了一切,但似乎无济于事。