-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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
[Mamba2
] Move dt calculations to kernel
#33520
[Mamba2
] Move dt calculations to kernel
#33520
Conversation
Maybe for clarification the referenced repo's mamba2 is mostly a mirror of this one. |
Thanks for the PR! Very interesting, not opposed but what exactly changes between the in-kernel and out-of-kernel computation results? Train mode vs eval mode yield different results? In that case we should also add it as a minimal test specific for mamba2! |
Just seems like that it's more aligned with the completely fused kernel then, or rather the numerical differences are minimized. Tbh it's a huge nit in and of itself :D I can add a slow test that requires a GPU and the kernels; would be a copy paste of the test in the repo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, just needs the copy-pasted test indeed (credit to the other repo) for future code inspectors!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! thanks for updating
Final step is running the slow tests for the model before merge, as this might have affected the integration tests. Could you push an empty commit with the message [run_slow] mamba
?
I'll write the test tomorrow and ping you then; I don't have much time this evening. |
Would be ready but ig waiting for #33560 to be merged seems appropriate for now 👀 |
Does it need a new decorator to check if the kernels are available or is it directly included in the slow runs? Might need an updated image if that's not the case. @molbap |
Nope, there's no such decorator! Slow run ought to do it :) |
e3cfa8a
to
ff0cb7c
Compare
Good to go now :) #33567 is to be expected |
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. |
@vasqu Pings are always welcome - it makes sure things aren't lost in the notification inbox :) |
* use kernel for dt calculations * add small test * [run-slow] mamba2
What does this PR do?
Moves calculations of
time_step
to the kernel instead of using torch's softplus directly. It seems like it influences the end result even more than expected, see fla-org/flash-linear-attention#63 for reference (2. point made there).Fixes # (issue)
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
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.
@ArthurZucker @molbap