Views
No views yet
model.onnx — full precision (~499 MB)model_int8.onnx — int8 quantized (~125 MB), smaller and faster with a small
accuracy trade-off| id | label |
|---|---|
| 0 | neutral |
| 1 | toxic |
neutral → safe and toxic → unsafe.1from huggingface_hub import hf_hub_download
2from transformers import AutoTokenizer
3import onnxruntime as ort
4
5repo = "AtliQ-Technologies/toxicity-fast-onnx"
6tok = AutoTokenizer.from_pretrained(repo)
7sess = ort.InferenceSession(hf_hub_download(repo, "model_int8.onnx"))
8
9enc = tok("text to check", return_tensors="np", truncation=True, max_length=128)
10inputs = {i.name: enc[i.name] for i in sess.get_inputs()}
11logits = sess.run(None, inputs)[0]
12print(["neutral", "toxic"][int(logits.argmax())])s-nlp/roberta_toxicity_classifier. Max sequence length 128.