Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Handle torch ver in flexattn #37400

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

Merged
merged 2 commits into from
Apr 10, 2025
Merged

Conversation

Kh4L
Copy link
Contributor

@Kh4L Kh4L commented Apr 9, 2025

Follow up #37399

@ArthurZucker

@github-actions github-actions bot marked this pull request as draft April 9, 2025 20:00
Copy link

github-actions bot commented Apr 9, 2025

Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the Ready for review button (at the bottom of the PR page). This will assign reviewers and trigger CI.

@Kh4L Kh4L marked this pull request as ready for review April 9, 2025 20:01
@github-actions github-actions bot requested review from MekkCyber and SunMarc April 9, 2025 20:01
@Kh4L Kh4L mentioned this pull request Apr 9, 2025
5 tasks
@@ -66,7 +66,7 @@ def __init__(self, training):
# cause errors. The suggested fix is to compile with "max-autotune-no-cudagraphs"
# see https://github.com/pytorch/pytorch/issues/146260 for training
self.training = training
if _torch_version.split("+")[0] == "2.6.0" and training:
if is_torch_greater_or_equal("2.6.0") and training:
Copy link
Contributor

@vasqu vasqu Apr 9, 2025

Choose a reason for hiding this comment

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

pytorch/pytorch#143299 should've fixed this issue so it makes more sense to directly look for 2.6.0 and not <=

I think it's fine to use from packaging import version ... instead of creating another function in the utils 👀 but up to debate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vasqu not what you mean here 🤔 this will check ">= 2.6.0", is_torch_greater_or_equal's already part of the package

I think it makes the check more futureproof

am I missing something?

Copy link
Contributor

@vasqu vasqu Apr 9, 2025

Choose a reason for hiding this comment

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

The torch version guard was introduced for torch==2.6.0 explicitly.

The PR I linked fixed some issues which should remove the need for this check, i.e. we don't need to compile with "max-autotune-no-cudagraphs". This means that future versions should also not need it which is why I suggested an == and not a 2.6.0<=.

Edit: the wording before was probably less than ideal :D

Copy link
Contributor Author

@Kh4L Kh4L Apr 9, 2025

Choose a reason for hiding this comment

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

Ok mb I got!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

update the PR to usd version instead of manual str checking, lmk how it looks to you

Copy link
Contributor

@vasqu vasqu left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

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

LGTM

@SunMarc SunMarc merged commit e39c732 into huggingface:main Apr 10, 2025
18 checks passed
LysandreJik pushed a commit that referenced this pull request Apr 14, 2025
* Handle torch ver in flexattn

* update
cyr0930 pushed a commit to cyr0930/transformers that referenced this pull request Apr 18, 2025
* Handle torch ver in flexattn

* update
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.

3 participants