--- 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". Model built under a TSI-100905-2019-4 project, co-financed by Ministry of Economic Affairs and Digital Transformation from the Government of Spain. # How to use it The model answer the following question: Is "phrase B" a paraphrase 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 use 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)) ``` Code output is: ``` tensor([[0.1592, 0.8408]], grad_fn=) ``` As the probability of 1 is 0.84, we can conclude from the previous example that "could be included" is paraphrase of "may be addressed".