nreimers
commited on
Commit
•
3616151
1
Parent(s):
cb68b8c
up
Browse files- CESoftmaxAccuracyEvaluator_AllNLI-dev_results.csv +13 -0
- README.md +38 -0
- config.json +32 -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
CESoftmaxAccuracyEvaluator_AllNLI-dev_results.csv
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
epoch,steps,Accuracy
|
2 |
+
0,10000,0.8128608857121055
|
3 |
+
0,20000,0.8258336936891105
|
4 |
+
0,30000,0.8371785414493933
|
5 |
+
0,40000,0.849668048737059
|
6 |
+
0,50000,0.8555439676442906
|
7 |
+
0,-1,0.854857171927861
|
8 |
+
1,10000,0.8612418284028184
|
9 |
+
1,20000,0.8619540609976344
|
10 |
+
1,30000,0.8658459033907359
|
11 |
+
1,40000,0.8682115330806603
|
12 |
+
1,50000,0.8688474550403175
|
13 |
+
1,-1,0.8696614351486786
|
README.md
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
The model was trained on the [SNLI](https://nlp.stanford.edu/projects/snli/) and [MultiNLI](https://cims.nyu.edu/~sbowman/multinli/) datasets. For a given sentence pair, it will output three scores corresponding to the labels: contradiction, entailment, neutral.
|
6 |
+
|
7 |
+
|
8 |
+
## Usage
|
9 |
+
|
10 |
+
Pre-trained models can be used like this:
|
11 |
+
```python
|
12 |
+
from sentence_transformers import CrossEncoder
|
13 |
+
model = CrossEncoder('model_name')
|
14 |
+
scores = model.predict([('A man is eating pizza', 'A man eats something'), ('A black race car starts up in front of a crowd of people.', 'A man is driving down a lonely road.')])
|
15 |
+
|
16 |
+
#Convert scores to labels
|
17 |
+
label_mapping = ['contradiction', 'entailment', 'neutral']
|
18 |
+
labels = [label_mapping[score_max] for score_max in scores.argmax(axis=1)]
|
19 |
+
```
|
20 |
+
|
21 |
+
## Usage with Transformers AutoModel
|
22 |
+
You can use the model also directly with Transformers library (without SentenceTransformers library):
|
23 |
+
```python
|
24 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
25 |
+
import torch
|
26 |
+
|
27 |
+
model = AutoModelForSequenceClassification.from_pretrained('model_name')
|
28 |
+
tokenizer = AutoTokenizer.from_pretrained('model_name')
|
29 |
+
|
30 |
+
features = tokenizer(['A man is eating pizza', 'A black race car starts up in front of a crowd of people.'], ['A man eats something', 'A man is driving down a lonely road.'], padding=True, truncation=True, return_tensors="pt")
|
31 |
+
|
32 |
+
model.eval()
|
33 |
+
with torch.no_grad():
|
34 |
+
scores = model(**features).logits
|
35 |
+
label_mapping = ['contradiction', 'entailment', 'neutral']
|
36 |
+
labels = [label_mapping[score_max] for score_max in scores.argmax(dim=1)]
|
37 |
+
print(labels)
|
38 |
+
```
|
config.json
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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": "contradiction",
|
14 |
+
"1": "entailment",
|
15 |
+
"2": "neutral"
|
16 |
+
},
|
17 |
+
"initializer_range": 0.02,
|
18 |
+
"intermediate_size": 3072,
|
19 |
+
"label2id": {
|
20 |
+
"contradiction": 0,
|
21 |
+
"entailment": 1,
|
22 |
+
"neutral": 2
|
23 |
+
},
|
24 |
+
"layer_norm_eps": 1e-05,
|
25 |
+
"max_position_embeddings": 514,
|
26 |
+
"model_type": "roberta",
|
27 |
+
"num_attention_heads": 12,
|
28 |
+
"num_hidden_layers": 6,
|
29 |
+
"pad_token_id": 1,
|
30 |
+
"type_vocab_size": 1,
|
31 |
+
"vocab_size": 50265
|
32 |
+
}
|
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:d272bba7769a509cd328dbda062279926d00550a635f4428998c1869a25f83b2
|
3 |
+
size 328532073
|
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}
|
vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|