@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / bd4c1e6fdb
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 15, 02:15 UTC

Support for LlamaForSequenceClassification (#20807)

Signed-off-by: thechaos16 <thechaos16@gmail.com>

Minkyu Kim committed Jul 13, 2025 at 16:09 UTC bd4c1e6fdbec56594079764bcb74c7e2a81ce525
3 files changed +7 -1
tests/models/registry.py
+1
@@ -330,6 +330,7 @@ _CROSS_ENCODER_EXAMPLE_MODELS = {
330 hf_overrides={"architectures": ["GemmaForSequenceClassification"], # noqa: E501
331 "classifier_from_token": ["Yes"], # noqa: E501
332 "method": "no_post_processing"}), # noqa: E501
333 + "LlamaForSequenceClassification": _HfExamplesInfo("Skywork/Skywork-Reward-V2-Llama-3.2-1B"), # noqa: E501
334 "ModernBertForSequenceClassification": _HfExamplesInfo("Alibaba-NLP/gte-reranker-modernbert-base", v0_only=True), # noqa: E501
335 "RobertaForSequenceClassification": _HfExamplesInfo("cross-encoder/quora-roberta-base", v0_only=True), # noqa: E501
336 "XLMRobertaForSequenceClassification": _HfExamplesInfo("BAAI/bge-reranker-v2-m3", v0_only=True), # noqa: E501
vllm/model_executor/models/llama.py
+4
@@ -49,6 +49,7 @@ from vllm.model_executor.model_loader.weight_utils import (
49 from vllm.model_executor.sampling_metadata import SamplingMetadata
50 from vllm.sequence import IntermediateTensors
51
52 +from .adapters import as_seq_cls_model
53 from .interfaces import SupportsLoRA, SupportsPP
54 from .utils import (AutoWeightsLoader, PPMissingLayer, extract_layer_index,
55 is_pp_missing_parameter,
@@ -645,3 +646,6 @@ class LlamaForCausalLM(nn.Module, SupportsLoRA, SupportsPP):
646 name = name.replace(item, mapping[item])
647
648 return name, loaded_weight
649 +
650 +
651 +LlamaForSequenceClassification = as_seq_cls_model(LlamaForCausalLM)
vllm/model_executor/models/registry.py
+2 -1
@@ -183,7 +183,8 @@ _CROSS_ENCODER_MODELS = {
183 "GemmaForSequenceClassification": ("gemma", "GemmaForSequenceClassification"), # noqa: E501
184 "Qwen2ForSequenceClassification": ("qwen2", "Qwen2ForSequenceClassification"), # noqa: E501
185 "Qwen3ForSequenceClassification": ("qwen3", "Qwen3ForSequenceClassification"), # noqa: E501
186 - "JinaVLForRanking": ("jina_vl", "JinaVLForSequenceClassification"), # noqa: E501
186 + "LlamaForSequenceClassification": ("llama", "LlamaForSequenceClassification"), # noqa: E501
187 + "JinaVLForRanking": ("jina_vl", "JinaVLForSequenceClassification"), # noqa: E501,
188 }
189
190 _MULTIMODAL_MODELS = {