File size: 2,083 Bytes
9f5ace5
 
 
9f8e064
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5a49de1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9f8e064
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
license: mit
---
# Cross-Encoder for MS Marco

This model was trained on the [MS Marco Passage Ranking](https://github.com/microsoft/MSMARCO-Passage-Ranking) task.

The model can be used for Information Retrieval: Given a query, encode the query will all possible passages (e.g. retrieved with ElasticSearch). Then sort the passages in a decreasing order. See our paper [R2ANKER](https://arxiv.org/pdf/2206.08063.pdf) for more details. 

## Usage with Transformers

```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
tokenizer = AutoTokenizer.from_pretrained("YCZhou/R2ANKER")
model = AutoModelForSequenceClassification.from_pretrained("YCZhou/R2ANKER")
features = tokenizer(['How many people live in Berlin?', 'How many people live in Berlin?'], ['Berlin has a population of 3,520,031 registered inhabitants in an area of 891.82 square kilometers.', 'New York City is famous for the Metropolitan Museum of Art.'],  padding=True, truncation=True, return_tensors="pt")
model.eval()
with torch.no_grad():
    scores = model(**features).logits
    print(scores)
```

## Citation
```
@inproceedings{DBLP:conf/acl/Zhou0GTXLJJ23,
  author       = {Yucheng Zhou and
                  Tao Shen and
                  Xiubo Geng and
                  Chongyang Tao and
                  Can Xu and
                  Guodong Long and
                  Binxing Jiao and
                  Daxin Jiang},
  title        = {Towards Robust Ranker for Text Retrieval},
  booktitle    = {Findings of the Association for Computational Linguistics: {ACL} 2023,
                  Toronto, Canada, July 9-14, 2023},
  pages        = {5387--5401},
  publisher    = {Association for Computational Linguistics},
  year         = {2023},
  url          = {https://doi.org/10.18653/v1/2023.findings-acl.332},
  doi          = {10.18653/V1/2023.FINDINGS-ACL.332},
  timestamp    = {Sat, 30 Sep 2023 09:33:34 +0200},
  biburl       = {https://dblp.org/rec/conf/acl/Zhou0GTXLJJ23.bib},
  bibsource    = {dblp computer science bibliography, https://dblp.org}
}
```