Downloads · 30 days
21
11% of all-time downloads
peeyush01/albert-paraphrase-detector
albert-paraphrase-detector is a sentence similarity model from peeyush01. Use it when you need a score for how close two texts are. It is set up for transformers. The card lists the license as apache-2.0.
This is a fine-tuned version of albert-base-v2 on paraphrase detection tasks such as GLUE-QQP (Quora Question Pairs) and MRPC (Microsoft Research Paraphrase Corpus). It can be used to determine whether two sentences a…
Downloads · 30 days
21
11% of all-time downloads
All-time downloads
196
Public
Parameters
11.7M
47.5 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors46.7 MB · 98%
From the Hugging Face model README
This is a fine-tuned version of albert-base-v2 on paraphrase detection tasks such as GLUE-QQP (Quora Question Pairs) and MRPC (Microsoft Research Paraphrase Corpus).
It can be used to determine whether two sentences are paraphrases (semantically similar) or not.
Example usage:
model = AutoModelForSequenceClassification.from_pretrained('peeyush01/albert-paraphrase-detector')
tokenizer = AutoTokenizer.from_pretrained('peeyush01/albert-paraphrase-detector-tokenizer')
def predict_paraphrase(sentence1, sentence2):
inputs = tokenizer(sentence1, sentence2, return_tensors="pt", padding=True, truncation=True)
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
probs = torch.softmax(logits, dim=1)
paraphrase_prob = probs[0][1].item()
return {"Paraphrase": paraphrase_prob, "Not Paraphrase": 1 - paraphrase_prob}
import torch
pairs = [
("The movie was fantastic!", "The film was amazing!"),
("He is playing cricket.", "She is reading a book."),
]
for s1, s2 in pairs:
result = predict_paraphrase(s1, s2)
print(f"Sentence 1: {s1}")
print(f"Sentence 2: {s2}")
print(f"Result: {result}\n")
1 → Paraphrase (semantically equivalent)0 → Not paraphrasemax_length).sentence1, sentence2, and idx were dropped.label → labels.albert-base-v2Trainer)Trainer.(Expected range for ALBERT-base on MRPC — please replace with your actual run metrics if available)
The fine-tuned ALBERT model achieves strong performance on the MRPC benchmark, demonstrating effectiveness at capturing semantic similarity and paraphrase relationships between sentence pairs.