hoan commited on
Commit
87059f2
1 Parent(s): 747c0b9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +42 -20
README.md CHANGED
@@ -13,10 +13,12 @@ Using `pipeline` from the `optimum` library
13
  from optimum.pipelines import pipeline as pipeline_onnx
14
 
15
  quantized_pipeline = pipeline_onnx(
16
- "text-classification",
17
- model="hoan/multilingual-toxic-xlm-roberta-dynamic-quantized",
18
- accelerator="ort",
19
- top_k=None)
 
 
20
 
21
  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."""
22
  result = quantized_pipeline(text)
@@ -24,20 +26,40 @@ result = quantized_pipeline(text)
24
 
25
  The result is:
26
  ```
27
- [[{'label': 'LABEL_0', 'score': 0.20129913091659546},
28
- {'label': 'LABEL_7', 'score': 0.15916699171066284},
29
- {'label': 'LABEL_8', 'score': 0.11170786619186401},
30
- {'label': 'LABEL_4', 'score': 0.08739417046308517},
31
- {'label': 'LABEL_14', 'score': 0.07075755298137665},
32
- {'label': 'LABEL_10', 'score': 0.06712991744279861},
33
- {'label': 'LABEL_2', 'score': 0.06049202010035515},
34
- {'label': 'LABEL_13', 'score': 0.05316930636763573},
35
- {'label': 'LABEL_3', 'score': 0.04292014613747597},
36
- {'label': 'LABEL_12', 'score': 0.041316740214824677},
37
- {'label': 'LABEL_15', 'score': 0.026307238265872},
38
- {'label': 'LABEL_9', 'score': 0.024316439405083656},
39
- {'label': 'LABEL_11', 'score': 0.017735131084918976},
40
- {'label': 'LABEL_5', 'score': 0.015682993456721306},
41
- {'label': 'LABEL_6', 'score': 0.01122154202312231},
42
- {'label': 'LABEL_1', 'score': 0.009382889606058598}]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  ```
 
13
  from optimum.pipelines import pipeline as pipeline_onnx
14
 
15
  quantized_pipeline = pipeline_onnx(
16
+ "text-classification",
17
+ model="hoan/multilingual-toxic-xlm-roberta-dynamic-quantized",
18
+ accelerator="ort",
19
+ top_k=None,
20
+ function_to_apply="sigmoid"
21
+ )
22
 
23
  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."""
24
  result = quantized_pipeline(text)
 
26
 
27
  The result is:
28
  ```
29
+ [[{'label': 'LABEL_0', 'score': 0.0004449746338650584},
30
+ {'label': 'LABEL_7', 'score': 0.00035187375033274293},
31
+ {'label': 'LABEL_8', 'score': 0.00024698078050278127},
32
+ {'label': 'LABEL_4', 'score': 0.00019323475135024637},
33
+ {'label': 'LABEL_14', 'score': 0.00015645574603695422},
34
+ {'label': 'LABEL_10', 'score': 0.0001484356907894835},
35
+ {'label': 'LABEL_2', 'score': 0.0001337601279374212},
36
+ {'label': 'LABEL_13', 'score': 0.00011757002357626334},
37
+ {'label': 'LABEL_3', 'score': 9.490883530816063e-05},
38
+ {'label': 'LABEL_12', 'score': 9.136357402894646e-05},
39
+ {'label': 'LABEL_15', 'score': 5.817503551952541e-05},
40
+ {'label': 'LABEL_9', 'score': 5.3772881074110046e-05},
41
+ {'label': 'LABEL_11', 'score': 3.9219678001245484e-05},
42
+ {'label': 'LABEL_5', 'score': 3.468171780696139e-05},
43
+ {'label': 'LABEL_6', 'score': 2.4815808501443826e-05},
44
+ {'label': 'LABEL_1', 'score': 2.0749821487697773e-05}]]
45
+ ```
46
+
47
+ The mapping for the labels is:
48
+ ```
49
+ {'LABEL_0': 'toxicity',
50
+ 'LABEL_1': 'severe_toxicity',
51
+ 'LABEL_2': 'obscene',
52
+ 'LABEL_3': 'identity_attack',
53
+ 'LABEL_4': 'insult',
54
+ 'LABEL_5': 'threat',
55
+ 'LABEL_6': 'sexual_explicit',
56
+ 'LABEL_7': 'male',
57
+ 'LABEL_8': 'female',
58
+ 'LABEL_9': 'homosexual_gay_or_lesbian',
59
+ 'LABEL_10': 'christian',
60
+ 'LABEL_11': 'jewish',
61
+ 'LABEL_12': 'muslim',
62
+ 'LABEL_13': 'black',
63
+ 'LABEL_14': 'white',
64
+ 'LABEL_15': 'psychiatric_or_mental_illness'}
65
  ```