-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add Bamba Model #10909
Add Bamba Model #10909
Conversation
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
👋 Hi! Thank you for contributing to the vLLM project. Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can do one of these:
🚀 |
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
Hi @fabianlim, thanks for the PR! It's really great to see progress being made on state-space models, especially for me as I unfortunately haven't been able to prioritize support for Mamba2 I'm happy to shepherd this PR and discuss any questions you have, especially to support chunked prefill. If you haven't already, can you join the developer slack for quicker discussion? (https://communityinviter.com/apps/vllm-dev/join-vllm-developers-slack) |
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
@tlrmchlsmth I cleaned up the PR quite abit, perhaps it might be a good time to get some early eyes. The chunked prefill implementation is incomplete ATM, as we discussed offline. |
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.
first pass, just a few comments. At a high level it looks good.
Will you add a test for tensor parallelism?
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
This pull request has merge conflicts that must be resolved before it can be |
@tlrmchlsmth i have addressed most of your comments now, not rebasing yet, waiting for you to look first. But I realized |
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.
@fabianlim At a high level, the changes look good, and the PR looks good overall. I'll do a more thorough review once it's unmarked as draft.
Could you add unit tests for the added kernels in layers/mamba/ops
?
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
@tlrmchlsmth thank you so much for your comments. I have fixed the |
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
I've been trying to get this PR green. Some of the issues are due to huggingface timeouts, but the kernels-test-3 failure is real. The log is too large to link to the problematic lines, but there is an illegal memory access during test_mamba_chunk_scan_cont_batch. |
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
@tlrmchlsmth oh man i cant reproduce the illegal memory access in my machine. Im trying to debug this by modifying the CI file to just trigger this particular test in the CI Update: yes if I run these tests only in the CI it passes, suggesting that the invalid memory access might be coming from somewhere else. Update: when disabling the test case it passes .
|
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
Signed-off-by: Yu Chin Fabian Lim <[email protected]>
Signed-off-by: Tyler Michael Smith <[email protected]>
Signed-off-by: Yu Chin Fabian Lim <[email protected]> Signed-off-by: Tyler Michael Smith <[email protected]> Co-authored-by: Tyler Michael Smith <[email protected]> Signed-off-by: Felix Marty <[email protected]>
This is the companion PR to an huggingface PR for adding
Bamba
, which is a hybrid mamba2 architecture with SwiGLU. The checkpoints are jointly trained by IBM, Princeton, and UIUC.In this PR we have:
bamba
model inference architecture, which we would like acknowledge thejamba
team for referencing their implementation, whereby we modified to support full attention layers with RoPE and mamba v2.Currently we have a partial solution, which works only when the cont batch boundaries line up with the chunked boundaries.This is now completely fixed.vllm/model_executor/layers/mamba/ops
. Only thefwd
kernels are extracted. Some modifications and fixes are made.tests/models/decoder_only/language/test_bamba.py
with an initialibm-fms/Bamba-9.8b-1.8T-hf
. This is practically identical totest_mamba.py
, only chunked prefill tests are disabled as it is currently not supported.Currently only
FlashAttention
backend is supported, as we check fields likecontext_lens_tensor
. Have not yet investigated other backends.We would like to also acknowledge the draft codestral mamba PR from @tlrmchlsmth, which we also referenced the mixer.
Hope to discuss the following with the maintainers
do we have to remove all theyes we shouldbwd
kernels?sin_cos
cache to cover the sequence length, if it is longer thanmax_sequence_len
.This differs for other current models (e.g., llama). How can we better support long sequence lengths?we should keep this consistent with other models, so we propose to allow thesin_cos
cache extension only whenVLLM_ALLOW_LONG_MAX_MODEL_LEN
is specified.have some ideas to support chunked pre-fill, but will appreciate some discussion with the maintainers on how to proceed.working on changing the kernels to support chunked prefill.since the mixer2 is simplified from mamba, should we rename it?we can keep it as is, but we should document the differences frommamba_ssm
cc: @ani300, @raghukiran1224, @cyang49, @njhill