Skip to content

Conversation

byi8220
Copy link
Contributor

@byi8220 byi8220 commented Nov 23, 2024

What does this PR do?

Fixes #20419

torch_xla.runtime.using_pjrt() is removed in pytorch/xla#7787

If torch_xla version >= 2.5, this PR replaces references to that function with a check to device_type() to recreate the behavior of that function, minus the manual initialization

Before submitting
  • Was this discussed/agreed via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)

PR review

Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:

Reviewer checklist
  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

📚 Documentation preview 📚: https://pytorch-lightning--20442.org.readthedocs.build/en/20442/

Fixes Lightning-AI#20419

`torch_xla.runtime.using_pjrt()` is removed in pytorch/xla#7787

This PR replaces references to that function with a check to [`device_type()`](https://github.com/pytorch/xla/blob/master/torch_xla/runtime.py#L83) to recreate the behavior of that function, minus the manual initialization
@github-actions github-actions bot added the fabric lightning.fabric.Fabric label Nov 23, 2024
@byi8220 byi8220 changed the title Replace using_pjrt() xla runtime device_type() check with in xla.py Replace using_pjrt() xla runtime device_type() check with in xla.py for torch-xla>=2.5 Nov 23, 2024
@byi8220 byi8220 marked this pull request as ready for review November 23, 2024 21:35
Copy link

codecov bot commented Nov 25, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 88%. Comparing base (8ce5287) to head (5ada0e1).
Report is 54 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #20442   +/-   ##
=======================================
- Coverage      88%      88%   -0%     
=======================================
  Files         267      267           
  Lines       23203    23207    +4     
=======================================
+ Hits        20313    20315    +2     
- Misses       2890     2892    +2     

Copy link
Collaborator

@lantiga lantiga left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@mergify mergify bot added the ready PRs ready to be merged label Nov 25, 2024
@lantiga lantiga merged commit 0afd4e1 into Lightning-AI:master Nov 25, 2024
107 of 112 checks passed
@byi8220 byi8220 deleted the patch-1 branch November 25, 2024 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fabric lightning.fabric.Fabric ready PRs ready to be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PyTorch Lightning uses deprecated torch_xla function, causing compatibility issues with latest torch_xla versions

3 participants