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

Better checks for if a TPU device exists #456

Merged
merged 2 commits into from
Jun 21, 2022
Merged

Better checks for if a TPU device exists #456

merged 2 commits into from
Jun 21, 2022

Conversation

muellerzr
Copy link
Collaborator

This PR fixes a situation where torch_xla is installed but a TPU device isn't present.

This originally would cause the import to pass, even though a TPU device isn't found. Instead we combine this with a quick xm.xla_device(), that raises a RuntimeError if not on a TPU.

I've tested this on a CPU and TPU version of Colab.

cc @sgugger

@muellerzr muellerzr added the bug Something isn't working label Jun 21, 2022
@muellerzr muellerzr requested a review from sgugger June 21, 2022 15:36
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Jun 21, 2022

The documentation is not available anymore as the PR was closed or merged.

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@muellerzr muellerzr merged commit 73a5965 into main Jun 21, 2022
@muellerzr muellerzr deleted the tpu-check branch June 21, 2022 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants