Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XLA error on CPU #9552

Closed
ckchow opened this issue Sep 16, 2021 · 2 comments · Fixed by #9572
Closed

XLA error on CPU #9552

ckchow opened this issue Sep 16, 2021 · 2 comments · Fixed by #9572
Labels
accelerator: tpu Tensor Processing Unit bug Something isn't working priority: 1 Medium priority task

Comments

@ckchow
Copy link
Contributor

ckchow commented Sep 16, 2021

https://github.com/PyTorchLightning/pytorch-lightning/blob/6e124e7207f6459cb43f540cfb5a1c6cc9b00f7a/pytorch_lightning/utilities/xla_device.py#L75

A somewhat unusual case, but this line causes a TypeError if you are using an XLA-enabled version of pytorch without any TPUs attached. (Google deprecated all of its non-XLA pytorch deep learning images so maybe this will become less unusual over time.)

This is because pytorch/xla returns a None and not an empty list if it can't find any devices of the desired type. Could we guard this with an is None or?

@SeanNaren
Copy link
Contributor

This sounds reasonable, would you be able to make a PR for this? cc @kaushikb11 any ideas how we'd test this?

@SeanNaren SeanNaren added bug Something isn't working accelerator: tpu Tensor Processing Unit priority: 1 Medium priority task labels Sep 16, 2021
@ckchow
Copy link
Contributor Author

ckchow commented Sep 16, 2021

I got it to pop by using the docker image gcr.io/deeplearning-platform-release/pytorch-xla.1-9, installing pytorch-lightning>=1.4.2, and I think just importing Trainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accelerator: tpu Tensor Processing Unit bug Something isn't working priority: 1 Medium priority task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants