nreimers commited on
Commit
ec8d4ad
1 Parent(s): b125516
CESoftmaxAccuracyEvaluator_AllNLI-dev_results.csv ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ epoch,steps,Accuracy
2
+ 0,10000,0.8567649378068324
3
+ 0,20000,0.8696614351486786
4
+ 0,30000,0.8731971612443721
5
+ 0,40000,0.8798107496248061
6
+ 0,50000,0.880522982219622
7
+ 0,-1,0.886246279856536
8
+ 1,10000,0.8877216188029405
9
+ 1,20000,0.8890952102357998
10
+ 1,30000,0.8895276371683667
11
+ 1,40000,0.8935212270750134
12
+ 1,50000,0.8950728766565768
13
+ 1,-1,0.8953272454404395
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": 12,
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:841b6e05e67fb1d920ea8f081eba18f12ea43890b6e8c0c13d558ab51c61890c
3
+ size 498682313
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