首页 > 解决方案 > "MisconfigurationError: No TPU devices were found" even when TPU is connected in PyTorch Lightning

问题描述

Have been frustrated over the past few hours over a problem, though It's likely its a problem I started myself hah.

I'm trying to connect to the TPU in Colab. I'm pretty sure I've gotten all the import stuff down. My code is here. I'm not completely set on everything, so the entire document isn't functional, but you should be able to see my attempts at TPU connection.

I'm running Pytorch in version 1.5.0 and torchvision in 0.6.0 because I was finding I couldn't install XLA with anything later than 1.5.0. I'm running XLA in version 20200325.

This is the image that seems so confusing: It states that we have a connection with xla: 1 yet when trying to flag it in the trainer I get an error saying no TPUs can be found.

enter image description here

If anyone could help me, that would be amazing.

Thanks, A

标签: pytorchtpupytorch-lightning

解决方案


我遇到了同样的问题,这些步骤解决了这个问题。

  1. 遵循 PyTorch-Lightning 文档:TPU 支持
  2. 添加另一个笔记本单元格:
%%capture
!curl https://raw.githubusercontent.com/pytorch/xla/master/contrib/scripts/env-setup.py -o pytorch-xla-env-setup.py > /dev/null
!python pytorch-xla-env-setup.py --version nightly --apt-packages libomp5 libopenblas-dev > /dev/null
!pip install pytorch-lightning > /dev/null

推荐阅读