paraphrase-bert-en / README.md
mplaza's picture
Update README.md
db86681
metadata
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".