[Model] Add zerank-2 reranker (#60415)
Signed-off-by: rdlhio <contact@rdlh.io>
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
{#- zerank-2 (zeroentropy/zerank-2-reranker): query in the system turn, document in the user turn.
|
||||
The assistant suffix is emitted unconditionally, since score templates are rendered
|
||||
without add_generation_prompt. An optional `instruction` is wrapped as recommended by
|
||||
ZeroEntropy; without it, the prompt is the official zerank-2 prompt. -#}
|
||||
{%- set query = messages | selectattr("role", "eq", "query") | map(attribute="content") | list -%}
|
||||
{%- set document = messages | selectattr("role", "eq", "document") | map(attribute="content") | list -%}
|
||||
{%- set query = query[0] if query else '' -%}
|
||||
{%- if instruction is defined and instruction is string and instruction | trim -%}
|
||||
{%- set query = '<query>' + query + '</query>\n<instruction>' + instruction + '</instruction>' -%}
|
||||
{%- endif -%}
|
||||
{{- '<|im_start|>system\n' + query + '<|im_end|>\n' -}}
|
||||
{{- '<|im_start|>user\n' + (document[0] if document else '') + '<|im_end|>\n' -}}
|
||||
{{- '<|im_start|>assistant\n' -}}
|
||||
@@ -53,6 +53,7 @@ def get_chat_template(model: str) -> str:
|
||||
"mixedbread-ai/mxbai-rerank-base-v2": "mxbai_rerank_v2.jinja",
|
||||
"mixedbread-ai/mxbai-rerank-large-v2": "mxbai_rerank_v2.jinja",
|
||||
"nvidia/llama-nemotron-rerank-1b-v2": "nemotron-rerank.jinja",
|
||||
"polaria-tech/zerank-2-reranker-vllm": "zerank2.jinja",
|
||||
}
|
||||
|
||||
# Get the template filename for the specified model
|
||||
@@ -110,6 +111,7 @@ def get_hf_overrides(model: str) -> dict[str, Any]:
|
||||
"method": "from_2_way_softmax",
|
||||
},
|
||||
"nvidia/llama-nemotron-rerank-1b-v2": {},
|
||||
"polaria-tech/zerank-2-reranker-vllm": {},
|
||||
}
|
||||
|
||||
hf_overrides = model_name_to_hf_overrides_map.get(model)
|
||||
|
||||
@@ -19,6 +19,7 @@ run:
|
||||
vllm serve tomaarsen/Qwen3-Reranker-0.6B-seq-cls --chat-template examples/pooling/score/template/qwen3_reranker.jinja
|
||||
vllm serve mixedbread-ai/mxbai-rerank-base-v2 --hf_overrides '{"architectures": ["Qwen2ForSequenceClassification"],"classifier_from_token": ["0", "1"], "method": "from_2_way_softmax"}' --chat-template examples/pooling/score/template/mxbai_rerank_v2.jinja
|
||||
vllm serve nvidia/llama-nemotron-rerank-1b-v2 --runner pooling --trust-remote-code --chat-template examples/pooling/score/template/nemotron-rerank.jinja
|
||||
vllm serve polaria-tech/zerank-2-reranker-vllm --runner pooling --chat-template examples/pooling/score/template/zerank2.jinja
|
||||
vllm serve Qwen/Qwen3-Reranker-0.6B --runner pooling --hf_overrides '{"architectures": ["Qwen3ForSequenceClassification"],"classifier_from_token": ["no", "yes"],"is_original_qwen3_reranker": true}' --chat-template examples/pooling/score/template/qwen3_reranker.jinja
|
||||
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user