Downloads · 30 days
34
1% of all-time downloads
hoan/multilingual-toxic-xlm-roberta-dynamic-quantized
multilingual-toxic-xlm-roberta-dynamic-quantized is a text classification model from hoan. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
This ONNX model is a dynamic quantized for the original model: https://huggingface.co/unitary/multilingual-toxic-xlm-roberta
Downloads · 30 days
34
1% of all-time downloads
All-time downloads
2.4K
Public
Repo size
302 MB
Likes
2
Public
Click a slice to open those files.
.onnx279 MB · 93%
From the Hugging Face model README
This ONNX model is a dynamic quantized for the original model: https://huggingface.co/unitary/multilingual-toxic-xlm-roberta
Using pipeline from the optimum library
from optimum.pipelines import pipeline as pipeline_onnx
quantized_pipeline = pipeline_onnx(
"text-classification",
model="hoan/multilingual-toxic-xlm-roberta-dynamic-quantized",
accelerator="ort",
top_k=None,
function_to_apply="sigmoid"
)
text = """Artificial intelligence (AI), frequently depicted in mainstream media as a harbinger of both groundbreaking innovation and understandable concern, has seamlessly permeated and embedded itself within a multitude of diverse sectors that constitute the intricate tapestry of our contemporary society. This relentless integration spans a wide spectrum, extending from the realms of healthcare, where AI is catalyzing transformative breakthroughs in disease diagnosis, treatment planning, and medical research, to the intricate domain of finance, where algorithms are reshaping the landscape of investment strategies, risk assessment, and market predictions."""
result = quantized_pipeline(text)
The result is:
[[{'label': 'LABEL_0', 'score': 0.0004449746338650584},
{'label': 'LABEL_7', 'score': 0.00035187375033274293},
{'label': 'LABEL_8', 'score': 0.00024698078050278127},
{'label': 'LABEL_4', 'score': 0.00019323475135024637},
{'label': 'LABEL_14', 'score': 0.00015645574603695422},
{'label': 'LABEL_10', 'score': 0.0001484356907894835},
{'label': 'LABEL_2', 'score': 0.0001337601279374212},
{'label': 'LABEL_13', 'score': 0.00011757002357626334},
{'label': 'LABEL_3', 'score': 9.490883530816063e-05},
{'label': 'LABEL_12', 'score': 9.136357402894646e-05},
{'label': 'LABEL_15', 'score': 5.817503551952541e-05},
{'label': 'LABEL_9', 'score': 5.3772881074110046e-05},
{'label': 'LABEL_11', 'score': 3.9219678001245484e-05},
{'label': 'LABEL_5', 'score': 3.468171780696139e-05},
{'label': 'LABEL_6', 'score': 2.4815808501443826e-05},
{'label': 'LABEL_1', 'score': 2.0749821487697773e-05}]]
The mapping for the labels is:
{'LABEL_0': 'toxicity',
'LABEL_1': 'severe_toxicity',
'LABEL_2': 'obscene',
'LABEL_3': 'identity_attack',
'LABEL_4': 'insult',
'LABEL_5': 'threat',
'LABEL_6': 'sexual_explicit',
'LABEL_7': 'male',
'LABEL_8': 'female',
'LABEL_9': 'homosexual_gay_or_lesbian',
'LABEL_10': 'christian',
'LABEL_11': 'jewish',
'LABEL_12': 'muslim',
'LABEL_13': 'black',
'LABEL_14': 'white',
'LABEL_15': 'psychiatric_or_mental_illness'}