反问句的重排似乎效果不佳

#5
by bash99 - opened

仍然是某个Q&A自动问答匹配的内部测试数据集,代码如下

import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer

model_name_or_path = 'Alibaba-NLP/gte-multilingual-reranker-base'

tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
model = AutoModelForSequenceClassification.from_pretrained(
    model_name_or_path, trust_remote_code=True,
    torch_dtype=torch.float32
)
model.eval()

pairs = [['当天买洁牙套餐可以当天去诊所洗牙吗?','当天在网上买的洁牙套餐,为什么当天不能使用?'], ['当天买洁牙套餐可以当天去诊所洗牙吗?', '只购买预约了单项洁牙套餐, 可以去补牙吗?']]
with torch.no_grad():
    inputs = tokenizer(pairs, padding=True, truncation=True, return_tensors='pt', max_length=512)
    scores = model(**inputs, return_dict=True).logits.view(-1, ).float()
    print(scores)
# 实际输出:tensor([0.1109, 0.1808])

同样例子在jinaai/jina-reranker-v2-base-multilingual 的输出是
tensor([-0.1208, -0.4309])

Alibaba-NLP org

感谢反馈,这个类别的case开源的模型确实有缺陷,我们争取下一个版本提升一下部分的能力

Sign up or log in to comment