Views
No views yet
| label | 定義 | Margin label |
|---|---|---|
| positive | d1 & d2 都必要 | 0 |
| neutral | 其中一段必要 | 1 |
| negative | 都不重要 | 2 |
naver/trecdl22-crossencoder-debertav3)的模型。
這是訓練在 Musique Dataset 的模型1from transformers import AutoTokenizer, AutoModel
2import torch, torch.nn.functional as F
3
4tokenizer = AutoTokenizer.from_pretrained("QQhahaha/musique-deberta-v3-large-MLP-2-Marginloss-ratio7")
5model = AutoModel.from_pretrained("QQhahaha/musique-deberta-v3-large-MLP-2-Marginloss-ratio7").eval()
6
7def score(q, d1, d2):
8 text = f"{q} [SEP] {d1} [SEP] {d2}"
9 inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
10 with torch.no_grad():
11 logit = model(**inputs).last_hidden_state[:,0,:] @ model.classifier[0].weight.T
12 return torch.sigmoid(logit).item() # 0~1,越高代表正向