Skip to content

Conversation

@Charlie-Bell
Copy link
Contributor

Edited one line in src/transormers/generation/utils.py. Changed dist.….world_size() to dist.get_world_size() since world_size() doesn't exist in pytorch.dist.

What does this PR do?

Fixes # Pytorch 2 generation/utils.py , 'torch.distributed' has no attribute 'world_size' #22375
#22375

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

Library:

…world_size() to dist.get_world_size() since world_size() doesn't exist in pytorch.dist.
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Mar 26, 2023

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

Copy link
Contributor

@gante gante left a comment

Choose a reason for hiding this comment

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

Seems like a sensible change, but I'm going to defer the review to someone more experience with dist :)

@gante gante requested a review from sgugger March 26, 2023 13:45
@gante
Copy link
Contributor

gante commented Mar 26, 2023

BTW, there is a CI error due to this branch being created from an older version of main -- you should rebase with main to make our CI green

@Charlie-Bell
Copy link
Contributor Author

BTW, there is a CI error due to this branch being created from an older version of main -- you should rebase with main to make our CI green

Funny, GitHub is telling me that "This branch is 1 commit ahead of huggingface:main." and also tells me the fork is already synced when I try syncing.
Also when I fetch upstream and rebase as in the contribution guidlines I am told "Current branch changed-world-size-to-get-world-size-in-generation-utils is up to date."

Maybe I missed something, but it seems the only difference in codebase is the 1 line change. Maybe it's worth it to re-run the ci/circleci: tests_torch_and_tf?

@gante
Copy link
Contributor

gante commented Mar 27, 2023

@Charlie-Bell my apologies, there is indeed a problem in main I've found after writing the comment above! #22383 will fix it -- apologies for the confusion 🙏

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.

Yes, that's the correct fix. Thanks a lot!

@sgugger sgugger merged commit d5c2c71 into huggingface:main Mar 27, 2023
raghavanone pushed a commit to raghavanone/transformers that referenced this pull request Apr 5, 2023
Edited one line in src/transormers/generation/utils.py. Changed dist.world_size() to dist.get_world_size() since world_size() doesn't exist in pytorch.dist.
novice03 pushed a commit to novice03/transformers that referenced this pull request Jun 23, 2023
Edited one line in src/transormers/generation/utils.py. Changed dist.world_size() to dist.get_world_size() since world_size() doesn't exist in pytorch.dist.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants