Instructions to use ihgn/Discriminator-Paraphrase with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ihgn/Discriminator-Paraphrase with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="ihgn/Discriminator-Paraphrase")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("ihgn/Discriminator-Paraphrase") model = AutoModelForSequenceClassification.from_pretrained("ihgn/Discriminator-Paraphrase") - Notebooks
- Google Colab
- Kaggle
# Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("ihgn/Discriminator-Paraphrase")
model = AutoModelForSequenceClassification.from_pretrained("ihgn/Discriminator-Paraphrase")Quick Links
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)
- Downloads last month
- 6
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="ihgn/Discriminator-Paraphrase")