mempooltx/bert-base-fallacy-detection
08
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
import torch.nn.functional as F
# Load the model and tokenizer
model = AutoModelForSequenceClassification.from_pretrained("mempooltx/bert-base-fallacy-detection")
tokenizer = AutoTokenizer.from_pretrained("mempooltx/bert-base-fallacy-detection")
# Prepare the text
text = "the sky is blue because the sky is blue"
inputs = tokenizer(text, padding=True, truncation=True, return_tensors="pt")
# Get predictions
model.eval()
with torch.no_grad():
outputs = model(**inputs)
# Convert logits to probabilities
probabilities = F.softmax(outputs.logits, dim=1)