CoolFace
Modelpublic

AtliQ-Technologies/guardex-distilbert-safety

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes8downloads
Model Card

GuardEx DistilBERT Safety Classifier

Binary classifier that labels a piece of text as safe or unsafe. Used by GuardEx, an LLM guardrail library, as one of its content-safety models. This is the fastest of the GuardEx classifiers, with the lowest accuracy of the three.

Labels

idlabel
0safe
1unsafe

Performance

Held-out evaluation:

  • F1: 0.720

Usage

python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

repo = "AtliQ-Technologies/guardex-distilbert-safety"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForSequenceClassification.from_pretrained(repo)

enc = tok("text to check", return_tensors="pt", truncation=True, max_length=128)
with torch.no_grad():
    logits = model(**enc).logits
print(model.config.id2label[int(logits.argmax())])  # "safe" or "unsafe"

Details

Fine-tuned from martin-ha/toxic-comment-model. Max sequence length 128.