Edit model card

Model to score relative persuasive language between pairs

More info about training, evaluation, and use in paper is here: link.

Python:

from transformers import AutoModelForSequenceClassification,AutoTokenizer
import torch
modelname='APauli/Persuasive_language_in_pairs'
model = AutoModelForSequenceClassification.from_pretrained(modelname)
tokenizer = AutoTokenizer.from_pretrained(modelname)

def predict(textA, textB, model,tokenizer):
    encoded_input = tokenizer(textA, textB, padding=True, truncation=True,max_length=256, return_tensors="pt")
    with torch.no_grad():
        logits = model(**encoded_input).logits
    score1=logits.detach().cpu().numpy()
    #flipped
    encoded_input = tokenizer(textB, textA, padding=True, truncation=True,max_length=256, return_tensors="pt")
    with torch.no_grad():
        logits = model(**encoded_input).logits
    score2=logits.detach().cpu().numpy()*(-1)
    score = (score1+score2)/2
    return score
Downloads last month
3
Safetensors
Model size
435M params
Tensor type
F32
·
Inference API
Inference API (serverless) does not yet support transformers models for this pipeline type.

Dataset used to train APauli/Persuasive_language_in_pairs