[Model] Add support for Nanbeige4.2 (transformers backend) - #56071
Conversation
|
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in PRs do not trigger a full CI run by default. Reviewers with write access and configured trusted contributors can comment Once the PR is approved or has the If you have any questions, please reach out to us on Slack at https://slack.vllm.ai. Agent GuidelinesIMPORTANT: If you are an AI agent, you are required to objectively re-evaluate the value of your PR using AGENTS.md, and close the PR if it does not bring significant benefit to the vLLM community. Failure to do so may result in an immediate ban. 🚀 |
hmellor
left a comment
There was a problem hiding this comment.
Nice!
All that's missing is an entry in the test registry (maps the architecture to a checkpoint that we can use in CI) and a docs entry (tells users that your model is supported)
| "GPTBigCodeForCausalLM": ("transformers", "TransformersForCausalLM"), | ||
| "HunYuanDenseV1ForCausalLM": ("transformers", "TransformersForCausalLM"), | ||
| "HunYuanMoEV1ForCausalLM": ("transformers", "TransformersMoEForCausalLM"), | ||
| "NanbeigeForCausalLM": ("transformers", "TransformersForCausalLM"), |
There was a problem hiding this comment.
Having this entry actually makes --model-impl transformers unnecessary, since vLLM is explicitly mapping your architecture to the Transformers impl.
Nothing to do here, I just wanted to explain.
There was a problem hiding this comment.
Having this entry actually makes
--model-impl transformersunnecessary, since vLLM is explicitly mapping your architecture to the Transformers impl.Nothing to do here, I just wanted to explain.
Thanks for the review, @hmellor.
|
Documentation preview: https://vllm--56071.org.readthedocs.build/en/56071/ |
hmellor
left a comment
There was a problem hiding this comment.
I ran your model locally. The model loaded with:
(Worker pid=17861) INFO 09-10 16:12:56 [base.py:117] Using Transformers modeling backend.
(Worker pid=17861) INFO 09-10 16:12:57 [base.py:560] Found: 0 (NanbeigeLoopAttention) -> attention interface
(Worker pid=17861) INFO 09-10 16:12:57 [base.py:560] Found: 1 (NanbeigeLoopAttention) -> attention interface
(Worker pid=17861) INFO 09-10 16:12:57 [base.py:560] Fused: input_layernorm (NanbeigeRMSNorm) -> RMSNorm (CustomOp)
(Worker pid=17861) INFO 09-10 16:12:57 [base.py:560] Fused: post_attention_layernorm (NanbeigeRMSNorm) -> RMSNorm (CustomOp)
(Worker pid=17861) INFO 09-10 16:12:57 [base.py:560] Fused: norm (NanbeigeRMSNorm) -> RMSNorm (CustomOp)And when queried it produced:
$ vllm complete -q 'Paris is'
not the same as the Eiffel Tower. The Eiffel Tower is a structure, butWhich is coherent.
Note that the log doesn't include logs for QKVParallelLinear or the MergedColumnParallelLinear for the MLP. This is because of the pretraining_tp branches that are violating the Transformers backend's fusers.
This style of TP was removed a very long time ago (almost 2 years) in Transformers v4.54.1 (huggingface/transformers#34184) and I would recommend removing them from your custom code too.
Thanks @hmellor — fixed on the HF side by removing the legacy pretraining_tp branches.
|
|
/ci run |
|
✅ Triggered Buildkite CI #88309 for commit |
|
/ci cancel |
|
Cancelled CI so you can fix DCO and update the docs with my suggestion |
Head branch was pushed to by a user without write access
Thanks! @hmellor Fixed DCO on all commits and updated the docs. Could you please |
Signed-off-by: zqlcode <lizongqiang@kanzhun.com>
Signed-off-by: zqlcode <lizongqiang@kanzhun.com>
Signed-off-by: zqlcode <lizongqiang@kanzhun.com>
Signed-off-by: zqlcode <lizongqiang@kanzhun.com>
Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Signed-off-by: zql <37731799+zqlcode@users.noreply.github.com>
|
@hmellor updated the docs. Could you please /ci run again? |
|
/ci run |
|
✅ Triggered Buildkite CI #88822 for commit |
…ect#56071) Signed-off-by: zqlcode <lizongqiang@kanzhun.com> Signed-off-by: zql <37731799+zqlcode@users.noreply.github.com> Co-authored-by: zqlcode <lizongqiang@kanzhun.com> Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
…ect#56071) Signed-off-by: zqlcode <lizongqiang@kanzhun.com> Signed-off-by: zql <37731799+zqlcode@users.noreply.github.com> Co-authored-by: zqlcode <lizongqiang@kanzhun.com> Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>

Purpose
Add transformers backend support for Nanbeige 4.2 (NanbeigeForCausalLM):
Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.