mplaza commited on
Commit
db86681
1 Parent(s): ab88ef9

Update README.md

Browse files

Add "how to use"

Files changed (1) hide show
  1. README.md +35 -1
README.md CHANGED
@@ -1,5 +1,6 @@
1
  ---
2
  pipeline_tag: text-classification
 
3
  language: en
4
  tags:
5
  - transformers
@@ -7,4 +8,37 @@ tags:
7
 
8
  # Prompsit/paraphrase-bert-en
9
 
10
- This model allows to evaluate paraphrases for a given phrase.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  pipeline_tag: text-classification
3
+ inference: false
4
  language: en
5
  tags:
6
  - transformers
 
8
 
9
  # Prompsit/paraphrase-bert-en
10
 
11
+ This model allows to evaluate paraphrases for a given phrase.
12
+ We have fine-tuned this model from pretrained "bert-base-uncased".
13
+
14
+
15
+
16
+ # How to usage
17
+
18
+ The model answer the following question: Is "phrase B" paraphrases of "phrase A".
19
+ Please note that we're considering phrases instead of sentences. Therefore, we must take into account that the model doesn't expect to find punctuation marks or long pieces of text.
20
+
21
+ Resulting probabilities correspond to classes:
22
+ * 0: Not a paraphrase
23
+ * 1: It's a paraphrase
24
+
25
+
26
+ You can usage the model like this:
27
+
28
+ ```
29
+ import torch
30
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
31
+
32
+ tokenizer = AutoTokenizer.from_pretrained("Prompsit/paraphrase-bert-en")
33
+ model = AutoModelForSequenceClassification.from_pretrained("Prompsit/paraphrase-bert-en")
34
+
35
+ input = tokenizer('may be addressed','could be included',return_tensors='pt')
36
+ logits = model(**input).logits
37
+ soft = torch.nn.Softmax(dim=1)
38
+ print(soft(logits))
39
+ ```
40
+ Output of previous code is:
41
+ ```
42
+ tensor([[0.1592, 0.8408]], grad_fn=<SoftmaxBackward>)
43
+ ```
44
+ As the probability of 1 is 0.84, we can conclude from the previous example that "could be included" is paraphrase of "may be included".