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

🐛 [HotFix] Handle Profiler Activities Based on PyTorch Version #3136

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

yhna940
Copy link
Contributor

@yhna940 yhna940 commented Oct 1, 2024

What does this PR do?

This PR adds support for XPU and MTIA profiler activities in accelerate.utils.dataclasses.ProfileKwargs based on the installed PyTorch version. These activities are included conditionally depending on whether the current PyTorch version supports them (XPU in 2.4.0 and MTIA in 2.1.0).

Fixes #3128

Changes made:

  • Added XPU_PROFILING_AVAILABLE_PYTORCH_VERSION and MITA_PROFILING_AVAILABLE_PYTORCH_VERSION constants to constants.py.
  • Updated ProfileKwargs._get_profiler_activity to conditionally include XPU and MTIA activities based on PyTorch version.

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?

@yhna940 yhna940 mentioned this pull request Oct 1, 2024
4 tasks
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@BenjaminBossan
Copy link
Member

Thanks a lot @yhna940 for providing this fix.

@jenspetersen It would be great if you could check if this solves your initial issue.

Copy link
Collaborator

@muellerzr muellerzr left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

@muellerzr
Copy link
Collaborator

Will go ahead and merge since it's been a bit

@muellerzr muellerzr merged commit cd93e35 into huggingface:main Oct 7, 2024
25 checks passed
@jenspetersen
Copy link

Sorry for the late reply, just wanted to say thanks for fixing :)

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.

profiler requires torch >= 2.4.0
5 participants