Views
No views yet
Qwen3ForSequenceClassification with num_labels=1. The relevance score of a
(query, passage) pair is the single regression logit read at the last (EOS)
token. Training builds the pair as "query: {{query}} passage: {{title}} {{text}}"
(no yes/no suffix) and appends EOS; score = logits[:, 0].This differs from the Megatron causal-LM rerankers in this release, which scorelogit(" yes") − logit(" no")at a prompt suffix. Load this one withAutoModelForSequenceClassification, notAutoModelForCausalLM.
1import torch
2from transformers import AutoModelForSequenceClassification, AutoTokenizer
3
4name = "brutusxu/tevatron3-reranker-8b-contrastive-hf"
5tok = AutoTokenizer.from_pretrained(name)
6model = AutoModelForSequenceClassification.from_pretrained(
7 name, num_labels=1, dtype=torch.bfloat16).cuda().eval()
8pair = "query: what is the capital of france passage: Paris is the capital of France."
9ids = tok(pair + tok.eos_token, return_tensors="pt").to("cuda")
10with torch.no_grad():
11 print(model(**ids).logits[0, 0].item())