Draft
Conversation
5c63621 to
391209f
Compare
This adds a small wrapper around common GPU calls that aims to break out of redundant vendor specific calls.
fe59e1c to
1f4860e
Compare
2a2c7ce to
123b776
Compare
3192fa2 to
0ff77ab
Compare
Contributor
|
View the CircleCI Test Summary for this PR: https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=45235&sha=0ff77a |
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: olmo_hybrid, qwen3_5, qwen3_5_moe, qwen3_next |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR adds a tiny "agnostic.gpu" utility that is meant to allow easy replacing of unnecessarily hard-coded vendor-specific code.
The code does not use
torch.acceleratoras it is still considered experimental, but feedback on that opinion is welcome.The example provided patches the flash linear attention Fused RMS norm gate patch to not require CUDA. The upstream library claims to be platform agnostic, so in theory, this should work on other platforms as well. This is a POC/RFC only, and I haven't tested whether this works in practice, but that seems to be slightly irrelevant to what this PR is meant to provide (if
FusedRMSNormGatedis not, in fact, supported on e.g. XPU devices, that is an upstream issue, which does not affect the validity of this patch).If something that does this is already present and I simply haven't found it, then I'd love to know about it. If there are other reasons that I'm not seeing as for why we need to insist on hard coded cuda checks for a seemingly platform agnostic feature, I'd love to hear that as well.
Code Agent Policy
The code was 90% human-written*. The idea was solidified/sanity-checked through chats with DeepSeek.
(* exception being the "is available" part, which was derived from a snippet DeepSeek threw at me while chatting:
)
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
These seem relevant: