Downloads · 30 days
4
31% of all-time downloads
damiangohrh123/deception-detector
deception-detector is a machine learning model from damiangohrh123. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Short description - DistilBERT fine‑tuned to predict "deception risk" - Fine tuned on LIAR, dailiDialog, and general deception datasets - Probabilities are temperature‑calibrated (see temperature.pt) so you can show a…
Downloads · 30 days
4
31% of all-time downloads
All-time downloads
13
Public
Parameters
67M
1.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors268 MB · 100%
From the Hugging Face model README
Short description
temperature.pt) so you can show a continuous risk score.Usage
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
import numpy as np
model_dir = "your-username/your-hf-repo" # or local path to folder with files
device = "cuda" if torch.cuda.is_available() else "cpu"
tok = AutoTokenizer.from_pretrained(model_dir)
model = AutoModelForSequenceClassification.from_pretrained(model_dir).to(device).eval()
# load temperature if present
temp = 1.0
try:
temp = float(torch.load(f"{model_dir}/temperature.pt", map_location="cpu").get("temperature", 1.0))
except Exception:
pass
def get_deception_risk(texts):
if isinstance(texts, str):
texts = [texts]
enc = tok(texts, truncation=True, padding=True, return_tensors="pt", max_length=256).to(device)
with torch.no_grad():
logits = model(**enc).logits
probs = torch.softmax(logits / temp, dim=-1)[:, 1].cpu().numpy() # index 1 = risky class
return probs
# example
print(get_deception_risk(["This review looks fake", "This is a genuine comment"]))