-
-
Notifications
You must be signed in to change notification settings - Fork 11.6k
[FEAT] [ROCm] [Embedding] Add encoder-only model support into ROCm Flash Attention to enable embedding models. #14664
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
Conversation
Signed-off-by: tjtanaa <[email protected]>
Signed-off-by: tjtanaa <[email protected]>
Signed-off-by: tjtanaa <[email protected]>
|
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run 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 either: Add 🚀 |
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: tjtanaa <[email protected]>
Signed-off-by: tjtanaa <[email protected]>
Signed-off-by: tjtanaa <[email protected]>
DarkLight1337
left a comment
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.
Thanks for implementing this!
…ash Attention to enable embedding models. (vllm-project#14664) Signed-off-by: tjtanaa <[email protected]> Signed-off-by: Richard Liu <[email protected]>
…ash Attention to enable embedding models. (vllm-project#14664) Signed-off-by: tjtanaa <[email protected]> Signed-off-by: Louis Ulmer <[email protected]>
…ash Attention to enable embedding models. (vllm-project#14664) Signed-off-by: tjtanaa <[email protected]>
…ash Attention to enable embedding models. (vllm-project#14664) Signed-off-by: tjtanaa <[email protected]> Signed-off-by: Mu Huai <[email protected]>
Description
This PR add the logic to enable ENCODER_ONLY model support to ROCm Flash Attention. Thus, enabling language embedding models and some vision language embedding models.
FIX #14062
FIX #14583
File changes:
vllm/attention/backends/rocm_flash_attn.py: Add ENCODER_ONLY code pathtests/models/embedding/language/test_embedding.py: Fix the code logic to enable unit tests for ROCm support. Re-group the embedding model to their correct category.tests/models/embedding/language/test_cls_models.py: Only test "half" datatype for ROCm support as ROCm Flash Attention does not support Float32 attention.tests/models/embedding/language/test_gritlm.py: Fix the bug where the tests are not skipped even ifxformerspackage is not installed.Tests
Locally ran tests:
tests/models/embedding/language[Passed]tests/models/embedding/vision_language/test_dse_qwen2_vl.py[Passed]tests/models/embedding/vision_language/test_llava_next.py. This test is skipped as this HF model only works on CUDA, failed on CPU and ROCm.tests/models/embedding/vision_language/test_phi3v.pyfailed because of this BUG [Bug]: Unit testtests/models/embedding/vision_language/test_phi3v.pyfailing #14677Since there is a change in the ROCm Flash Attention module, I have also ensure all the unittests below passed
tests/models/decoder_only/language/test_models.py[Passed]Experimental Results:
The same embedding model is run on A100, L40 and MI300X, the embedding output is compared:
Model launch command:
VLLM_USE_TRITON_FLASH_ATTN=0 vllm serve Alibaba-NLP/gte-Qwen2-7B-instruct --dtype float16 --max-num-seqs 512 --gpu-memory-utilization 0.95 --hf-overrides '{"is_causal": false}' --trust-remote-codeComparison of Embedding Model Performance Across Different Hardware
Note: All p-values from paired t-tests were >0.05, indicating no statistically significant differences between platforms.
Things to future PR
In the unit tests
tests/models/embedding/language/test_embedding.py, if I ranpytest.param("ssmits/Qwen2-7B-Instruct-embed-base"), directly after
pytest.param("Alibaba-NLP/gte-Qwen2-7B-instruct"), the "ssmits/Qwen2-7B-Instruct-embed-base" tests will fail.
e.g.
Error message snippet:
It might be due to the fact that the environment or resource are not deallocated correctly between unit tests run.