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

Why mamba2 is much slower than transformer (flash attn)? #378

Closed
TimothyChen225 opened this issue Jun 9, 2024 · 3 comments
Closed

Why mamba2 is much slower than transformer (flash attn)? #378

TimothyChen225 opened this issue Jun 9, 2024 · 3 comments

Comments

@TimothyChen225
Copy link

No description provided.

@Dexterp37
Copy link

See #355 and #367

@AlwaysFHao
Copy link

I also encountered the same problem. Referring to the author's explanation in the #355 it is necessary to pre compile the model, which can be referred to https://discuss.pytorch.org/t/how-to-use-torch-compile-with-cuda-graphs-when-using-gradient-activation-checkpointing/179466.
You can wrap your model with the following code, although the first round of forward propagation will be very slow, the subsequent propagation will be very fast:
model_compile = torch.compile(model, mode="reduce-overhead")

@TimothyChen225
Copy link
Author

I also encountered the same problem. Referring to the author's explanation in the #355 it is necessary to pre compile the model, which can be referred to https://discuss.pytorch.org/t/how-to-use-torch-compile-with-cuda-graphs-when-using-gradient-activation-checkpointing/179466. You can wrap your model with the following code, although the first round of forward propagation will be very slow, the subsequent propagation will be very fast: model_compile = torch.compile(model, mode="reduce-overhead")

thks for help, but it is still slow

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

No branches or pull requests

3 participants