Views
No views yet
roberta-large1from transformers import RobertaTokenizer, RobertaForSequenceClassification
2import torch
3
4tokenizer = RobertaTokenizer.from_pretrained("Shushant/ADAL-Detector-PANCLEF")
5model = RobertaForSequenceClassification.from_pretrained("Shushant/ADAL-Detector-PANCLEF")
6model.eval()
7
8text = "Your text here."
9enc = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
10with torch.no_grad():
11 probs = torch.softmax(model(**enc).logits, dim=-1)[0]
12print(f"P(human)={probs[1]:.3f} P(AI)={probs[0]:.3f}")