File size: 1,325 Bytes
73822e2
e09db4f
db86681
73822e2
 
 
 
 
 
 
db86681
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
pipeline_tag: text-classification
inference: false
language: en
tags:
- transformers
---

# Prompsit/paraphrase-bert-en

This model allows to evaluate paraphrases for a given phrase.  
We have fine-tuned this model from pretrained "bert-base-uncased".



# How to usage 

The model answer the following question: Is "phrase B" paraphrases of "phrase A".
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.

Resulting probabilities correspond to classes:  
* 0: Not a paraphrase
* 1: It's a paraphrase


You can usage the model like this:

```
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("Prompsit/paraphrase-bert-en")
model = AutoModelForSequenceClassification.from_pretrained("Prompsit/paraphrase-bert-en")

input = tokenizer('may be addressed','could be included',return_tensors='pt')
logits = model(**input).logits
soft = torch.nn.Softmax(dim=1)
print(soft(logits))
```
Output of previous code is:
 ``` 
 tensor([[0.1592, 0.8408]], grad_fn=<SoftmaxBackward>) 
 ```
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".