Text Classification
Transformers
Safetensors
English
modernbert
toxicity
content-moderation
multi-label-classification
multilingual
text-embeddings-inference
Instructions to use wagesj45/multilabel-toxic-comment-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use wagesj45/multilabel-toxic-comment-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="wagesj45/multilabel-toxic-comment-classifier")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("wagesj45/multilabel-toxic-comment-classifier") model = AutoModelForSequenceClassification.from_pretrained("wagesj45/multilabel-toxic-comment-classifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Publish seven-label toxicity classifier
Browse files- .gitattributes +1 -0
- LICENSE +197 -0
- README.md +135 -0
- config.json +98 -0
- model.safetensors +3 -0
- tokenizer.json +3 -0
- tokenizer_config.json +25 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
LICENSE
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or Object
|
| 36 |
+
form, made available under the License, as indicated by a copyright
|
| 37 |
+
notice that is included in or attached to the work (an example is
|
| 38 |
+
provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the Work
|
| 90 |
+
or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You meet
|
| 92 |
+
the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or Derivative Works
|
| 95 |
+
a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works that
|
| 101 |
+
You distribute, all copyright, patent, trademark, and attribution
|
| 102 |
+
notices from the Source form of the Work, excluding those notices
|
| 103 |
+
that do not pertain to any part of the Derivative Works; and
|
| 104 |
+
|
| 105 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 106 |
+
distribution, then any Derivative Works that You distribute must
|
| 107 |
+
include a readable copy of the attribution notices contained
|
| 108 |
+
within such NOTICE file, excluding those notices that do not
|
| 109 |
+
pertain to any part of the Derivative Works, in at least one
|
| 110 |
+
of the following places: within a NOTICE text file distributed
|
| 111 |
+
as part of the Derivative Works; within the Source form or
|
| 112 |
+
documentation, if provided along with the Derivative Works; or,
|
| 113 |
+
within a display generated by the Derivative Works, if and
|
| 114 |
+
wherever such third-party notices normally appear. The contents
|
| 115 |
+
of the NOTICE file are for informational purposes only and
|
| 116 |
+
do not modify the License. You may add Your own attribution
|
| 117 |
+
notices within Derivative Works that You distribute, alongside
|
| 118 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 119 |
+
that such additional attribution notices cannot be construed
|
| 120 |
+
as modifying the License.
|
| 121 |
+
|
| 122 |
+
You may add Your own copyright statement to Your modifications and
|
| 123 |
+
may provide additional or different license terms and conditions
|
| 124 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 125 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 126 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 127 |
+
the conditions stated in this License.
|
| 128 |
+
|
| 129 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 130 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 131 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 132 |
+
this License, without any additional terms or conditions.
|
| 133 |
+
|
| 134 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 135 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 136 |
+
except as required for reasonable and customary use in describing the
|
| 137 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 138 |
+
|
| 139 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 140 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 141 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 142 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 143 |
+
implied, including, without limitation, any warranties or conditions
|
| 144 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 145 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 146 |
+
appropriateness of using or redistributing the Work and assume any
|
| 147 |
+
risks associated with Your exercise of permissions under this License.
|
| 148 |
+
|
| 149 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 150 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 151 |
+
unless required by applicable law (such as deliberate and grossly
|
| 152 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 153 |
+
liable to You for damages, including any direct, indirect, special,
|
| 154 |
+
incidental, or consequential damages of any character arising as a
|
| 155 |
+
result of this License or out of the use or inability to use the
|
| 156 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 157 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 158 |
+
other commercial damages or losses), even if such Contributor
|
| 159 |
+
has been advised of the possibility of such damages.
|
| 160 |
+
|
| 161 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 162 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 163 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 164 |
+
or other liability obligations and/or rights consistent with this
|
| 165 |
+
License. However, in accepting such obligations, You may act only
|
| 166 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 167 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 168 |
+
defend, and hold each Contributor harmless for any liability
|
| 169 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 170 |
+
of your accepting any such warranty or additional liability.
|
| 171 |
+
|
| 172 |
+
END OF TERMS AND CONDITIONS
|
| 173 |
+
|
| 174 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 175 |
+
|
| 176 |
+
To apply the Apache License to your work, attach the following
|
| 177 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 178 |
+
replaced with your own identifying information. (Don't include
|
| 179 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 180 |
+
comment syntax for the file format. We also recommend that a
|
| 181 |
+
file or class name and description of purpose be included on the
|
| 182 |
+
same "printed page" as the copyright notice for easier
|
| 183 |
+
identification within third-party archives.
|
| 184 |
+
|
| 185 |
+
Copyright [yyyy] [name of copyright owner]
|
| 186 |
+
|
| 187 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 188 |
+
you may not use this file except in compliance with the License.
|
| 189 |
+
You may obtain a copy of the License at
|
| 190 |
+
|
| 191 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 192 |
+
|
| 193 |
+
Unless required by applicable law or agreed to in writing, software
|
| 194 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 195 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 196 |
+
See the License for the specific language governing permissions and
|
| 197 |
+
limitations under the License.
|
README.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: text-classification
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
base_model: datalama/mmBERT-small
|
| 8 |
+
datasets:
|
| 9 |
+
- google/civil_comments
|
| 10 |
+
- Heliosoph/Jigsaw-Toxic-Comments
|
| 11 |
+
tags:
|
| 12 |
+
- toxicity
|
| 13 |
+
- content-moderation
|
| 14 |
+
- multi-label-classification
|
| 15 |
+
- modernbert
|
| 16 |
+
- multilingual
|
| 17 |
+
metrics:
|
| 18 |
+
- roc_auc
|
| 19 |
+
- f1
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
# Multilabel Toxic Comment Classifier
|
| 23 |
+
|
| 24 |
+
This model produces seven independent moderation scores for English comments:
|
| 25 |
+
`toxicity`, `severe_toxicity`, `obscene`, `threat`, `insult`,
|
| 26 |
+
`identity_attack`, and `sexual_explicit`. It is a fine-tune of
|
| 27 |
+
[`datalama/mmBERT-small`](https://huggingface.co/datalama/mmBERT-small), a
|
| 28 |
+
multilingual ModernBERT/mmBERT base model.
|
| 29 |
+
|
| 30 |
+
This is a multi-label classifier, not a mutually exclusive class classifier.
|
| 31 |
+
Every output is a sigmoid score and a comment can score highly on multiple
|
| 32 |
+
dimensions. `toxicity` is trained as its own target; it is not computed as an
|
| 33 |
+
OR of the other labels.
|
| 34 |
+
|
| 35 |
+
## Intended use
|
| 36 |
+
|
| 37 |
+
Use the scores as one input to a broader content-moderation workflow. Choose
|
| 38 |
+
and validate a separate decision threshold for every label and review decisions
|
| 39 |
+
in context. Do not use this model as the sole basis for high-impact decisions
|
| 40 |
+
about people.
|
| 41 |
+
|
| 42 |
+
## Usage
|
| 43 |
+
|
| 44 |
+
```python
|
| 45 |
+
import torch
|
| 46 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 47 |
+
|
| 48 |
+
model_id = "wagesj45/multilabel-toxic-comment-classifier"
|
| 49 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 50 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_id).eval()
|
| 51 |
+
|
| 52 |
+
inputs = tokenizer(
|
| 53 |
+
"Your text to score goes here.",
|
| 54 |
+
return_tensors="pt",
|
| 55 |
+
truncation=True,
|
| 56 |
+
max_length=256,
|
| 57 |
+
)
|
| 58 |
+
with torch.no_grad():
|
| 59 |
+
scores = torch.sigmoid(model(**inputs).logits[0]).tolist()
|
| 60 |
+
|
| 61 |
+
result = {
|
| 62 |
+
model.config.id2label.get(index, model.config.id2label.get(str(index))): score
|
| 63 |
+
for index, score in enumerate(scores)
|
| 64 |
+
}
|
| 65 |
+
print(result)
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
The model's saved label order is:
|
| 69 |
+
|
| 70 |
+
1. `toxicity`
|
| 71 |
+
2. `severe_toxicity`
|
| 72 |
+
3. `obscene`
|
| 73 |
+
4. `threat`
|
| 74 |
+
5. `insult`
|
| 75 |
+
6. `identity_attack`
|
| 76 |
+
7. `sexual_explicit`
|
| 77 |
+
|
| 78 |
+
Scores are model outputs, not calibrated probabilities. Thresholds should be
|
| 79 |
+
chosen for the target application and monitored after deployment.
|
| 80 |
+
|
| 81 |
+
## Training
|
| 82 |
+
|
| 83 |
+
The model was fine-tuned with `transformers` on
|
| 84 |
+
[`google/civil_comments`](https://huggingface.co/datasets/google/civil_comments)
|
| 85 |
+
and
|
| 86 |
+
[`Heliosoph/Jigsaw-Toxic-Comments`](https://huggingface.co/datasets/Heliosoph/Jigsaw-Toxic-Comments).
|
| 87 |
+
Civil Comments supplies all seven continuous annotation-fraction targets.
|
| 88 |
+
Jigsaw supplies binary targets for the first six dimensions; its unavailable
|
| 89 |
+
`sexual_explicit` label is masked from loss rather than treated as negative.
|
| 90 |
+
|
| 91 |
+
The combined corpus was shuffled and split deterministically 90/10 with seed
|
| 92 |
+
42. Training used three epochs, a learning rate of `2e-5`, batch sizes 16/32,
|
| 93 |
+
weight decay `0.01`, and a 256-token input limit. The exported weights are the
|
| 94 |
+
best checkpoint, selected by validation macro ROC-AUC at epoch 2.
|
| 95 |
+
|
| 96 |
+
## Evaluation
|
| 97 |
+
|
| 98 |
+
Evaluation used the held-out split described above. Metrics threshold soft
|
| 99 |
+
annotation targets at 0.5 for F1; ROC-AUC uses the continuous model scores.
|
| 100 |
+
|
| 101 |
+
| Label | ROC-AUC | F1 at 0.5 |
|
| 102 |
+
| --- | ---: | ---: |
|
| 103 |
+
| toxicity | 0.9744 | 0.6992 |
|
| 104 |
+
| severe_toxicity | 0.9991 | 0.4085 |
|
| 105 |
+
| obscene | 0.9936 | 0.7141 |
|
| 106 |
+
| threat | 0.9894 | 0.4847 |
|
| 107 |
+
| insult | 0.9802 | 0.6959 |
|
| 108 |
+
| identity_attack | 0.9873 | 0.3902 |
|
| 109 |
+
| sexual_explicit | 0.9967 | 0.5075 |
|
| 110 |
+
| **Macro average** | **0.9887** | **0.5571** |
|
| 111 |
+
|
| 112 |
+
These results are not a measure of performance on arbitrary production
|
| 113 |
+
comments or languages outside the evaluation data.
|
| 114 |
+
|
| 115 |
+
## Limitations and risks
|
| 116 |
+
|
| 117 |
+
- The training and evaluation comments are English. The multilingual base model
|
| 118 |
+
does not establish validated performance for non-English text.
|
| 119 |
+
- Toxicity labels are subjective and noisy, and data may carry historical or
|
| 120 |
+
cultural biases.
|
| 121 |
+
- Profanity, reclaimed language, identity terms, quotations, discussions of
|
| 122 |
+
abuse, and strongly worded criticism can cause false positives.
|
| 123 |
+
- The model can miss implicit, coded, contextual, or adversarially written
|
| 124 |
+
abuse.
|
| 125 |
+
- Use application-specific thresholds, appeals, human review, and monitoring
|
| 126 |
+
for real moderation systems.
|
| 127 |
+
|
| 128 |
+
## Licensing and provenance
|
| 129 |
+
|
| 130 |
+
The fine-tuned model artifacts in this repository are released under the
|
| 131 |
+
[Apache License 2.0](LICENSE). The listed base model and both listed Hugging
|
| 132 |
+
Face training datasets use Apache-2.0 and CC0-1.0 licensing, respectively;
|
| 133 |
+
refer to their dataset cards for source attribution and terms. This repository
|
| 134 |
+
does not redistribute training rows. Any future hard-negative data must be
|
| 135 |
+
documented with its source and license before use in a released model.
|
config.json
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"ModernBertForSequenceClassification"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 2,
|
| 8 |
+
"classifier_activation": "gelu",
|
| 9 |
+
"classifier_bias": false,
|
| 10 |
+
"classifier_dropout": 0.0,
|
| 11 |
+
"classifier_pooling": "mean",
|
| 12 |
+
"cls_token_id": 1,
|
| 13 |
+
"decoder_bias": true,
|
| 14 |
+
"deterministic_flash_attn": false,
|
| 15 |
+
"dtype": "float32",
|
| 16 |
+
"embedding_dropout": 0.0,
|
| 17 |
+
"eos_token_id": 1,
|
| 18 |
+
"global_attn_every_n_layers": 3,
|
| 19 |
+
"gradient_checkpointing": false,
|
| 20 |
+
"hidden_activation": "gelu",
|
| 21 |
+
"hidden_size": 384,
|
| 22 |
+
"id2label": {
|
| 23 |
+
"0": "toxicity",
|
| 24 |
+
"1": "severe_toxicity",
|
| 25 |
+
"2": "obscene",
|
| 26 |
+
"3": "threat",
|
| 27 |
+
"4": "insult",
|
| 28 |
+
"5": "identity_attack",
|
| 29 |
+
"6": "sexual_explicit"
|
| 30 |
+
},
|
| 31 |
+
"initializer_cutoff_factor": 2.0,
|
| 32 |
+
"initializer_range": 0.02,
|
| 33 |
+
"intermediate_size": 1152,
|
| 34 |
+
"label2id": {
|
| 35 |
+
"identity_attack": 5,
|
| 36 |
+
"insult": 4,
|
| 37 |
+
"obscene": 2,
|
| 38 |
+
"severe_toxicity": 1,
|
| 39 |
+
"sexual_explicit": 6,
|
| 40 |
+
"threat": 3,
|
| 41 |
+
"toxicity": 0
|
| 42 |
+
},
|
| 43 |
+
"layer_norm_eps": 1e-05,
|
| 44 |
+
"layer_types": [
|
| 45 |
+
"full_attention",
|
| 46 |
+
"sliding_attention",
|
| 47 |
+
"sliding_attention",
|
| 48 |
+
"full_attention",
|
| 49 |
+
"sliding_attention",
|
| 50 |
+
"sliding_attention",
|
| 51 |
+
"full_attention",
|
| 52 |
+
"sliding_attention",
|
| 53 |
+
"sliding_attention",
|
| 54 |
+
"full_attention",
|
| 55 |
+
"sliding_attention",
|
| 56 |
+
"sliding_attention",
|
| 57 |
+
"full_attention",
|
| 58 |
+
"sliding_attention",
|
| 59 |
+
"sliding_attention",
|
| 60 |
+
"full_attention",
|
| 61 |
+
"sliding_attention",
|
| 62 |
+
"sliding_attention",
|
| 63 |
+
"full_attention",
|
| 64 |
+
"sliding_attention",
|
| 65 |
+
"sliding_attention",
|
| 66 |
+
"full_attention"
|
| 67 |
+
],
|
| 68 |
+
"local_attention": 128,
|
| 69 |
+
"mask_token_id": 4,
|
| 70 |
+
"max_position_embeddings": 8192,
|
| 71 |
+
"mlp_bias": false,
|
| 72 |
+
"mlp_dropout": 0.0,
|
| 73 |
+
"model_type": "modernbert",
|
| 74 |
+
"norm_bias": false,
|
| 75 |
+
"norm_eps": 1e-05,
|
| 76 |
+
"num_attention_heads": 6,
|
| 77 |
+
"num_hidden_layers": 22,
|
| 78 |
+
"pad_token_id": 0,
|
| 79 |
+
"position_embedding_type": "sans_pos",
|
| 80 |
+
"problem_type": "multi_label_classification",
|
| 81 |
+
"rope_parameters": {
|
| 82 |
+
"full_attention": {
|
| 83 |
+
"rope_theta": 160000.0,
|
| 84 |
+
"rope_type": "default"
|
| 85 |
+
},
|
| 86 |
+
"sliding_attention": {
|
| 87 |
+
"rope_theta": 160000.0,
|
| 88 |
+
"rope_type": "default"
|
| 89 |
+
}
|
| 90 |
+
},
|
| 91 |
+
"sep_token_id": 1,
|
| 92 |
+
"sparse_pred_ignore_index": -100,
|
| 93 |
+
"sparse_prediction": false,
|
| 94 |
+
"tie_word_embeddings": true,
|
| 95 |
+
"transformers_version": "5.15.1",
|
| 96 |
+
"use_cache": false,
|
| 97 |
+
"vocab_size": 256000
|
| 98 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cb551fc0e8a58721d456fc3b2c2d57e33c2666f66e2b90806dbc153248bef51c
|
| 3 |
+
size 562591100
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4379fe7f4a7af10b1ac15ffc8ae90f446f92082393699e9dd54b8c3b5ec0abad
|
| 3 |
+
size 34363286
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"bos_token": "<bos>",
|
| 4 |
+
"clean_up_tokenization_spaces": false,
|
| 5 |
+
"cls_token": "<bos>",
|
| 6 |
+
"eos_token": "<eos>",
|
| 7 |
+
"extra_special_tokens": [
|
| 8 |
+
"<start_of_turn>",
|
| 9 |
+
"<end_of_turn>"
|
| 10 |
+
],
|
| 11 |
+
"is_local": false,
|
| 12 |
+
"local_files_only": false,
|
| 13 |
+
"mask_token": "<mask>",
|
| 14 |
+
"model_input_names": [
|
| 15 |
+
"input_ids",
|
| 16 |
+
"attention_mask"
|
| 17 |
+
],
|
| 18 |
+
"model_max_length": 8192,
|
| 19 |
+
"pad_token": "<pad>",
|
| 20 |
+
"padding_side": "right",
|
| 21 |
+
"sep_token": "<eos>",
|
| 22 |
+
"spaces_between_special_tokens": false,
|
| 23 |
+
"tokenizer_class": "TokenizersBackend",
|
| 24 |
+
"unk_token": "<unk>"
|
| 25 |
+
}
|