nreimers
commited on
Commit
•
45a65f3
1
Parent(s):
48a8a8b
up
Browse files- CESoftmaxAccuracyEvaluator_AllNLI-dev_results.csv +13 -0
- README.md +38 -0
- bpe_encoder.bin +3 -0
- config.json +40 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- tokenizer_config.json +1 -0
CESoftmaxAccuracyEvaluator_AllNLI-dev_results.csv
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
epoch,steps,Accuracy
|
2 |
+
0,10000,0.8647301215851859
|
3 |
+
0,20000,0.8722083736073664
|
4 |
+
0,30000,0.8845195095894592
|
5 |
+
0,40000,0.8869105153380475
|
6 |
+
0,50000,0.8886910515338048
|
7 |
+
0,-1,0.8922521239253193
|
8 |
+
1,10000,0.8953553441522104
|
9 |
+
1,20000,0.8956605789286259
|
10 |
+
1,30000,0.898204202065422
|
11 |
+
1,40000,0.9005443353512743
|
12 |
+
1,50000,0.9018670193824083
|
13 |
+
1,-1,0.9018670193824083
|
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 |
+
```
|
bpe_encoder.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:caff5a98d15fd439255194f3fcfd41a7b276b500cdf69caba890ae242c498797
|
3 |
+
size 3918127
|
config.json
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "microsoft/deberta-base",
|
3 |
+
"architectures": [
|
4 |
+
"DebertaForSequenceClassification"
|
5 |
+
],
|
6 |
+
"attention_probs_dropout_prob": 0.1,
|
7 |
+
"hidden_act": "gelu",
|
8 |
+
"hidden_dropout_prob": 0.1,
|
9 |
+
"hidden_size": 768,
|
10 |
+
"id2label": {
|
11 |
+
"0": "LABEL_0",
|
12 |
+
"1": "LABEL_1",
|
13 |
+
"2": "LABEL_2"
|
14 |
+
},
|
15 |
+
"initializer_range": 0.02,
|
16 |
+
"intermediate_size": 3072,
|
17 |
+
"label2id": {
|
18 |
+
"LABEL_0": 0,
|
19 |
+
"LABEL_1": 1,
|
20 |
+
"LABEL_2": 2
|
21 |
+
},
|
22 |
+
"layer_norm_eps": 1e-07,
|
23 |
+
"max_position_embeddings": 512,
|
24 |
+
"max_relative_positions": -1,
|
25 |
+
"model_type": "deberta",
|
26 |
+
"num_attention_heads": 12,
|
27 |
+
"num_hidden_layers": 12,
|
28 |
+
"pad_token_id": 0,
|
29 |
+
"pooler_dropout": 0,
|
30 |
+
"pooler_hidden_act": "gelu",
|
31 |
+
"pooler_hidden_size": 768,
|
32 |
+
"pos_att_type": [
|
33 |
+
"c2p",
|
34 |
+
"p2c"
|
35 |
+
],
|
36 |
+
"position_biased_input": false,
|
37 |
+
"relative_attention": true,
|
38 |
+
"type_vocab_size": 0,
|
39 |
+
"vocab_size": 50265
|
40 |
+
}
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c0ef040f1fba1b3ff1916e2dd02b3d73d161dd085907e5181ef26261d65df69f
|
3 |
+
size 556869824
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
|
tokenizer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"do_lower_case": false, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "model_max_length": 512, "name_or_path": "microsoft/deberta-base"}
|