abbasgolestani commited on
Commit
b7bee3b
1 Parent(s): 2296013

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +67 -0
README.md CHANGED
@@ -1,3 +1,70 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ datasets:
4
+ - multi_nli
5
+ - pietrolesci/nli_fever
6
+ pipeline_tag: text-classification
7
+ tags:
8
+ - feature-extraction
9
+ - sentence-similarity
10
+ - transformers
11
+ language:
12
+ - en
13
+ - nl
14
+ - de
15
+ - fr
16
+ - it
17
+ - es
18
  ---
19
+
20
+ # Cross-Encoder for Sentence Similarity
21
+ This model was trained using [SentenceTransformers](https://sbert.net) [Cross-Encoder](https://www.sbert.net/examples/applications/cross-encoder/README.html) class.
22
+
23
+ ## Training Data
24
+ This model was trained on 6 different nli datasets. The model will predict a score between 0 (not similar) and 1 (very similar) for the semantic similarity of two sentences.
25
+
26
+
27
+ ## Usage (CrossEncoder)
28
+ Comparing each sentence of sentences1 array to the corrosponding sentence of sentences2 array like comparing the first sentnece of each array, then comparing the second sentence of each array,...
29
+ ```python
30
+ from sentence_transformers import CrossEncoder
31
+
32
+
33
+ model = CrossEncoder('abbasgolestani/ag-nli-DeTS-sentence-similarity-v3-light')
34
+
35
+ # Two lists of sentences
36
+ sentences1 = ['I am honored to be given the opportunity to help make our company better',
37
+ 'I love my job and what I do here',
38
+ 'I am excited about our company’s vision']
39
+
40
+ sentences2 = ['I am hopeful about the future of our company',
41
+ 'My work is aligning with my passion',
42
+ 'Definitely our company vision will be the next breakthrough to change the world and I’m so happy and proud to work here']
43
+
44
+ pairs = zip(sentences1,sentences2)
45
+ list_pairs=list(pairs)
46
+
47
+ scores1 = model.predict(list_pairs, show_progress_bar=False)
48
+ print(scores1)
49
+
50
+ for i in range(len(sentences1)):
51
+ print("{} \t\t {} \t\t Score: {:.4f}".format(sentences1[i], sentences2[i], scores1[i]))
52
+
53
+ ```
54
+
55
+
56
+
57
+
58
+
59
+ ## Usage #2
60
+
61
+ Pre-trained models can be used like this:
62
+ ```python
63
+ from sentence_transformers import CrossEncoder
64
+ model = CrossEncoder('abbasgolestani/ag-nli-DeTS-sentence-similarity-v3-light')
65
+ scores = model.predict([('Sentence 1', 'Sentence 2'), ('Sentence 3', 'Sentence 4')])
66
+ ```
67
+
68
+ The model will predict scores for the pairs `('Sentence 1', 'Sentence 2')` and `('Sentence 3', 'Sentence 4')`.
69
+
70
+ You can use this model also without sentence_transformers and by just using Transformers ``AutoModel`` class