Views
No views yet
textA is supported by textB. More specifically, it's a 2-way classification where the relationship between textA and textB can be entail, neutral, contradict.textA, textB)textA=hypothesis, textB=premise1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2tokenizer = AutoTokenizer.from_pretrained("potsawee/deberta-v3-large-mnli")
3model = AutoModelForSequenceClassification.from_pretrained("potsawee/deberta-v3-large-mnli")
4
5textA = "Kyle Walker has a personal issue"
6textB = "Kyle Walker will remain Manchester City captain following reports about his private life, says boss Pep Guardiola."
7
8inputs = tokenizer.batch_encode_plus(
9 batch_text_or_text_pairs=[(textA, textB)],
10 add_special_tokens=True, return_tensors="pt",
11)
12logits = model(**inputs).logits # neutral is already removed
13probs = torch.softmax(logits, dim=-1)[0]
14# probs = [0.7080, 0.2920], meaning that prob(entail) = 0.708, prob(contradict) = 0.2921@article{manakul2023selfcheckgpt,
2 title={Selfcheckgpt: Zero-resource black-box hallucination detection for generative large language models},
3 author={Manakul, Potsawee and Liusie, Adian and Gales, Mark JF},
4 journal={arXiv preprint arXiv:2303.08896},
5 year={2023}
6}