Downloads · 30 days
11
2% of all-time downloads
ihgn/paraphrase-detection
paraphrase-detection is a text classification model from ihgn. Use it when you need a label for a piece of text. It is set up for transformers.
tokenizer = BartTokenizer.frompretrained('ihgn/paraphrase-detection') model = BartForConditionalGeneration.frompretrained("ihgn/paraphrase-detection").to(device) sourcesentence = "This was a series of nested angular s…
Downloads · 30 days
11
2% of all-time downloads
All-time downloads
483
Public
Repo size
1.3 GB
Likes
1
Public
Click a slice to open those files.
.bin626 MB · 100%
From the Hugging Face model README
tokenizer = BartTokenizer.from_pretrained('ihgn/paraphrase-detection')
model = BartForConditionalGeneration.from_pretrained("ihgn/paraphrase-detection").to(device)
source_sentence = "This was a series of nested angular standards , so that measurements in azimuth and elevation could be done directly in polar coordinates relative to the ecliptic."
target_paraphrase = "This was a series of nested polar scales , so that measurements in azimuth and elevation could be performed directly in angular coordinates relative to the ecliptic"
def paraphrase_detection(model, tokenizer, source_sentence, target_paraphrase):
# Tokenize the input sentence
inputs = tokenizer.encode_plus(source_sentence + ' <sep> ' + target_paraphrase, return_tensors='pt')
# Classify the input using the model
with torch.no_grad():
outputs = model.generate(inputs['input_ids'].to(device))
# Get the predicted label
predicted_label = 1 if generated_text == '1' else 0
print("Predicted Label:", predicted_label)
paraphrase_detection(model, tokenizer, source_sentence, target_paraphrase)