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

Flash Attention 2 for audio/musicgen #27552

Closed
yoinked-h opened this issue Nov 17, 2023 · 7 comments
Closed

Flash Attention 2 for audio/musicgen #27552

yoinked-h opened this issue Nov 17, 2023 · 7 comments
Labels
Feature request Request for a new feature Good Second Issue Issues that are more difficult to do than "Good First" issues - give it a try if you want!

Comments

@yoinked-h
Copy link
Contributor

Feature request

Add flash attention 2 to musicgen models (and or audio gen)

Motivation

Musicgen is a really large model, and its very hard to run on consumer GPUs, adding flash attention could make the model much lighter and possibly faster.

Your contribution

I can test on both WSL and windows 11 on a 3060

@amyeroberts amyeroberts added the Feature request Request for a new feature label Nov 17, 2023
@amyeroberts
Copy link
Collaborator

cc @sanchit-gandhi @ylacombe

@sanchit-gandhi sanchit-gandhi added the Good Second Issue Issues that are more difficult to do than "Good First" issues - give it a try if you want! label Dec 1, 2023
@sanchit-gandhi
Copy link
Contributor

Would indeed be cool having FA2 support for MusicGen! Since MusicGen copies the attention mechanism from Bart, you can copy the changes from this PR: #27203

Would you like to have a go at this integration @yoinked-h? It should be quite a fun PR where you get quite big speed-ups for not too much additional effort!

@yoinked-h
Copy link
Contributor Author

I've tried to implement the Bart flash attention as best as i could, but i get some error (cu_seqlens_k must have shape (batch_size + 1)) from the module itself, will try tomorrow!

@staghado
Copy link
Contributor

staghado commented Dec 4, 2023

I would like to help if possible

@ylacombe
Copy link
Contributor

ylacombe commented Dec 8, 2023

Hey @yoinked-h and @staghado, as @sanchit-gandhi pointed it should be fun to add!
Feel free to open a PR so that you can have our help on this

@amosyou
Copy link
Contributor

amosyou commented Apr 19, 2024

we can close this due to #29939

@yoinked-h
Copy link
Contributor Author

amazing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request Request for a new feature Good Second Issue Issues that are more difficult to do than "Good First" issues - give it a try if you want!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants