GuardEx toxicity-fast (ONNX)

RoBERTa toxicity classifier exported to ONNX for fast CPU inference. This is the default safety classifier loaded by GuardEx in local mode.

The repo ships two weights:

  • model.onnx โ€” full precision (~499 MB)
  • model_int8.onnx โ€” int8 quantized (~125 MB), smaller and faster with a small accuracy trade-off

Labels

id label
0 neutral
1 toxic

GuardEx maps neutral โ†’ safe and toxic โ†’ unsafe.

Usage

from huggingface_hub import hf_hub_download
from transformers import AutoTokenizer
import onnxruntime as ort

repo = "AtliQ-Technologies/toxicity-fast-onnx"
tok = AutoTokenizer.from_pretrained(repo)
sess = ort.InferenceSession(hf_hub_download(repo, "model_int8.onnx"))

enc = tok("text to check", return_tensors="np", truncation=True, max_length=128)
inputs = {i.name: enc[i.name] for i in sess.get_inputs()}
logits = sess.run(None, inputs)[0]
print(["neutral", "toxic"][int(logits.argmax())])

Details

Exported from s-nlp/roberta_toxicity_classifier. Max sequence length 128.

Downloads last month
54
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for AtliQ-Technologies/toxicity-fast-onnx

Quantized
(2)
this model