-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
[Model] Re-add the implicit conversion feature for as_seq_cls_model #21103
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: wang.yuqi <noooop@126.com>
Signed-off-by: wang.yuqi <noooop@126.com>
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.
Code Review
This pull request re-introduces implicit model conversion for sequence classification models, which is a great simplification. The changes involve refactoring the model registry and configuration logic to automatically handle these conversions. My review found a critical issue in the model registry where a cached object is being mutated, which could lead to incorrect behavior for other models. I've provided a detailed explanation and a suggested fix for this issue.
👋 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 🚀 |
Signed-off-by: wang.yuqi <noooop@126.com>
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.
This is a super cool PR! Thanks for enabling this for the Transformers backend!
Would it be better if the Transformes backend directly supported ForSequenceClassification
instead of the substitution you're doing in vllm/model_executor/models/registry.py
?
The Transformers backend directly supporting ForSequenceClassification is definitely better, I am not familiar with the Transformers backend and don't know what difficulties might arise. |
Once #20543 is merged I can look at adding explicit support for To clarify, is this PR specifically about enabling the Transformers backend or is it useful for other reasons too? |
This PR should wait for #21058 landing. |
Essential Elements of an Effective PR Description Checklist
supported_models.md
andexamples
for a new model.Purpose
Because: ForSequenceClassification using TRANSFORMERS Impl It is implemented using TransformersForCausalLM + as_classification_model, instead of directly using TransformersForSequenceClassification
That is, implicit conversion is essential.
We should implicit conversion ForSequenceClassification models, instead of adding them one by one to registry.py
hitchhike
is_matryoshka
matryoshka_dimensions is [] or None, is_matryoshka should be false.
get_and_verify_max_len
Consider max_model_len in tokenizer_config only when pooling models and using absolute position_embedding.
fix load_weights_no_post_processing tp weight loader
cc @DarkLight1337 @maxdebayser
Test Plan
pytest -s -vvv tests/models/test_transformers.py::test_classify
pytest -s -vvv tests/models/test_initialization.py::test_implicit_converted_models
Test Result
passed
(Optional) Documentation Update
Known Issues
ForSequenceClassification using TRANSFORMERS Impl It is implemented using TransformersForCausalLM + as_classification_model, instead of directly using TransformersForSequenceClassification
as_classification_model only supports gpt style score head, and does not support bert style classifier head, which makes vllm unable to support models like DebertaV2ForSequenceClassification