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

[torch-xla 2.7] Change xm.xrt_world_size() to xr.world_size(). xm.get_ordinal() to xr.global_ordinal() #37301

Open
1 of 4 tasks
jeffhataws opened this issue Apr 5, 2025 · 2 comments
Labels

Comments

@jeffhataws
Copy link
Contributor

System Info

In torch-xla version 2.7, xm.xrt_world_size() is replaced by xr.world_size() and xm.get_ordinal() is replaced by xr.global_ordinal() (xr is "import torch_xla.runtime as xr")

https://github.com/search?q=repo%3Ahuggingface%2Ftransformers+xrt_world_size&type=code
https://github.com/search?q=repo%3Ahuggingface%2Ftransformers+get_ordinal&type=code

Currently these show up as warnings in torch-xla 2.5/2.6:

WARNING:root:torch_xla.core.xla_model.xrt_world_size() will be removed in release 2.7. is deprecated. Use torch_xla.runtime.world_size instead.            
WARNING:root:torch_xla.core.xla_model.xla_model.get_ordinal() will be removed in release 2.7. is deprecated. Use torch_xla.runtime.global_ordinal instead. 

Who can help?

No response

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

  1. Run any finetuning/training test on Neuron or TPU
  2. Look for warnings like below: WARNING:root:torch_xla.core.xla_model.xrt_world_size() will be removed in release 2.7. is deprecated. Use torch_xla.runtime.world_size instead.
    WARNING:root:torch_xla.core.xla_model.xla_model.get_ordinal() will be removed in release 2.7. is deprecated. Use torch_xla.runtime.global_ordinal instead.

Expected behavior

No warnings.

With torch-xla 2.7, you will see errors.

@jeffhataws jeffhataws added the bug label Apr 5, 2025
@Rocketknight1
Copy link
Member

This is in trainer so cc @muellerzr @SunMarc - I think we can just search-replace with the new methods?

@SunMarc
Copy link
Member

SunMarc commented Apr 7, 2025

Yeah, we are replacing them in accelerate. I'll ping the author to do the same in transformers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants