Text Ranking
sentence-transformers
PyTorch
JAX
ONNX
Safetensors
OpenVINO
Transformers
English
roberta
text-classification
text-embeddings-inference
Instructions to use cross-encoder/quora-roberta-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use cross-encoder/quora-roberta-base with sentence-transformers:
from sentence_transformers import CrossEncoder model = CrossEncoder("cross-encoder/quora-roberta-base") query = "Which planet is known as the Red Planet?" passages = [ "Venus is often called Earth's twin because of its similar size and proximity.", "Mars, known for its reddish appearance, is often referred to as the Red Planet.", "Jupiter, the largest planet in our solar system, has a prominent red spot.", "Saturn, famous for its rings, is sometimes mistaken for the Red Planet." ] scores = model.predict([(query, passage) for passage in passages]) print(scores) - Transformers
How to use cross-encoder/quora-roberta-base with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("cross-encoder/quora-roberta-base") model = AutoModelForSequenceClassification.from_pretrained("cross-encoder/quora-roberta-base") - Notebooks
- Google Colab
- Kaggle
nreimers commited on
Commit ·
2ae203f
1
Parent(s): 297f82c
upload
Browse files- CEBinaryClassificationEvaluator_Quora-dev_results.csv +15 -0
- README.md +18 -0
- config.json +28 -0
- merges.txt +0 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- tokenizer_config.json +1 -0
- vocab.json +0 -0
CEBinaryClassificationEvaluator_Quora-dev_results.csv
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
epoch,steps,Accuracy,Accuracy_Threshold,F1,F1_Threshold,Precision,Recall,Average_Precision
|
| 2 |
+
0,5000,0.8608639203700198,0.2873433232307434,0.8098558473933306,0.19083455204963684,0.7614130434782609,0.8648815495022764,0.8629331317298123
|
| 3 |
+
0,10000,0.863839225338779,0.25037556886672974,0.8119228437979106,0.12073762714862823,0.7546394485683987,0.8786171772513311,0.8678734374248867
|
| 4 |
+
0,15000,0.8680587487490194,0.2262679636478424,0.8200071968333933,0.11036892235279083,0.7682556806688693,0.8792345088355583,0.875549687970233
|
| 5 |
+
0,20000,0.8685456168348165,0.20787009596824646,0.8190316830962862,0.12376940995454788,0.7747041012936967,0.8687398719036963,0.8764299796079794
|
| 6 |
+
0,25000,0.8720077898893728,0.3845294713973999,0.8250813155041562,0.2559159994125366,0.7759499694106451,0.8808550042441546,0.8833998414872404
|
| 7 |
+
0,30000,0.8729815260609667,0.5238280296325684,0.8255852051403401,0.3320024907588959,0.781461061337009,0.8749903541939964,0.878249009917573
|
| 8 |
+
0,-1,0.8710611019447675,0.4382350444793701,0.8225952648562416,0.149741068482399,0.7758172616605116,0.8753761864341384,0.8821009813520877
|
| 9 |
+
1,5000,0.8723864650672148,0.13579325377941132,0.8250017981730562,0.046766698360443115,0.772546642419344,0.8850991588857164,0.8772769680139632
|
| 10 |
+
1,10000,0.8706012820859592,0.17663632333278656,0.8243606757289911,0.04282882809638977,0.7701380511995711,0.8867968207423412,0.8717299987211413
|
| 11 |
+
1,15000,0.8711963430797112,0.062239423394203186,0.8229883392482075,0.025501983240246773,0.775366769020812,0.876842348946678,0.88006993940756
|
| 12 |
+
1,20000,0.8719266452084066,0.03155897557735443,0.8244302380178423,0.010280131362378597,0.7749185225420967,0.8807006713480978,0.8812910141874843
|
| 13 |
+
1,25000,0.8726028508831246,0.03645790368318558,0.8253768844221104,0.03082387149333954,0.7918468628146047,0.8618720580291689,0.8816145619414946
|
| 14 |
+
1,30000,0.8732249601038652,0.03989178314805031,0.8268535595721136,0.029114533215761185,0.7920288318846724,0.8648815495022764,0.8793008086700131
|
| 15 |
+
1,-1,0.8735765870547185,0.05718168243765831,0.8270970543533329,0.018996555358171463,0.7787393526405452,0.8818581680685238,0.8779853764105872
|
README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Cross-Encoder for Quora Duplicate Questions Detection
|
| 2 |
+
This model was trained using [SentenceTransformers](https://sbert.net) [Cross-Encoder](https://www.sbert.net/examples/applications/cross-encoder/README.html) class.
|
| 3 |
+
|
| 4 |
+
## Training Data
|
| 5 |
+
This model was trained on the [Quora Duplicate Questions](https://www.quora.com/q/quoradata/First-Quora-Dataset-Release-Question-Pairs) dataset. The model will predict a score between 0 and 1 how likely the two given questions are duplicates.
|
| 6 |
+
|
| 7 |
+
Note: The model is not suitable to estimate the similarity of questions, e.g. the two questions "How to learn Java" and "How to learn Python" will result in a rahter low score, as these are not duplicates.
|
| 8 |
+
|
| 9 |
+
## Usage and Performance
|
| 10 |
+
|
| 11 |
+
Pre-trained models can be used like this:
|
| 12 |
+
```
|
| 13 |
+
from sentence_transformers import CrossEncoder
|
| 14 |
+
model = CrossEncoder('model_name')
|
| 15 |
+
scores = model.predict([('Question 1', 'Question 2'), ('Question 3', 'Question 4')])
|
| 16 |
+
```
|
| 17 |
+
|
| 18 |
+
You can use this model also without sentence_transformers and by just using Transformers ``AutoModel`` class
|
config.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"RobertaForSequenceClassification"
|
| 4 |
+
],
|
| 5 |
+
"attention_probs_dropout_prob": 0.1,
|
| 6 |
+
"bos_token_id": 0,
|
| 7 |
+
"eos_token_id": 2,
|
| 8 |
+
"gradient_checkpointing": false,
|
| 9 |
+
"hidden_act": "gelu",
|
| 10 |
+
"hidden_dropout_prob": 0.1,
|
| 11 |
+
"hidden_size": 768,
|
| 12 |
+
"id2label": {
|
| 13 |
+
"0": "LABEL_0"
|
| 14 |
+
},
|
| 15 |
+
"initializer_range": 0.02,
|
| 16 |
+
"intermediate_size": 3072,
|
| 17 |
+
"label2id": {
|
| 18 |
+
"LABEL_0": 0
|
| 19 |
+
},
|
| 20 |
+
"layer_norm_eps": 1e-05,
|
| 21 |
+
"max_position_embeddings": 514,
|
| 22 |
+
"model_type": "roberta",
|
| 23 |
+
"num_attention_heads": 12,
|
| 24 |
+
"num_hidden_layers": 12,
|
| 25 |
+
"pad_token_id": 1,
|
| 26 |
+
"type_vocab_size": 1,
|
| 27 |
+
"vocab_size": 50265
|
| 28 |
+
}
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fbebb63aa533e7d3b68b2e0d205287523fff83ab36e434003d55f855e699acc6
|
| 3 |
+
size 498676169
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"bos_token": {"content": "<s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "eos_token": {"content": "</s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "unk_token": {"content": "<unk>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "sep_token": {"content": "</s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "pad_token": {"content": "<pad>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "cls_token": {"content": "<s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "mask_token": {"content": "<mask>", "single_word": false, "lstrip": true, "rstrip": false, "normalized": true}}
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"model_max_length": 512, "special_tokens_map_file": "final-models/ce-roberta-base-mnli/special_tokens_map.json", "full_tokenizer_file": null}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|