Views
No views yet
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.| id | label |
|---|---|
| 0 | safe |
| 1 | unsafe |
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4repo = "AtliQ-Technologies/guardex-distilbert-safety"
5tok = AutoTokenizer.from_pretrained(repo)
6model = AutoModelForSequenceClassification.from_pretrained(repo)
7
8enc = tok("text to check", return_tensors="pt", truncation=True, max_length=128)
9with torch.no_grad():
10 logits = model(**enc).logits
11print(model.config.id2label[int(logits.argmax())]) # "safe" or "unsafe"martin-ha/toxic-comment-model. Max sequence length 128.