Text Classification
Transformers
PyTorch
bert
content-moderation
self-harm
text-embeddings-inference
Run this model with HF Jobs
Run dkuzmenko/self-harm-bert on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/dkuzmenko/self-harm-bert. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/dkuzmenko/self-harm-bert on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use dkuzmenko/self-harm-bert with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dkuzmenko/self-harm-bert with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="dkuzmenko/self-harm-bert")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("dkuzmenko/self-harm-bert") model = AutoModelForSequenceClassification.from_pretrained("dkuzmenko/self-harm-bert", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Dmytro Kuzmenko commited on
Commit ·
e3997d2
1
Parent(s): f76ae2d
Add model card and MIT license
Browse files123456789101112131415161718192021MIT License
Copyright (c) 2022 Dmytro Kuzmenko
Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758---license: mitlibrary_name: transformerspipeline_tag: text-classificationbase_model: google-bert/bert-base-multilingual-uncasedtags:- bert- text-classification- content-moderation- self-harm---# self-harm-bert
A binary text classifier that flags whether a piece of text contains self-harm content. It is `bert-base-multilingual-uncased` fine-tuned for sequence classification with two labels.
| Label | Meaning ||---|---|| `LABEL_0` | No self-harm content || `LABEL_1` | Self-harm content |
The config has no label names, so the pipeline returns `LABEL_0` and `LABEL_1`.
## Usage
```pythonfrom transformers import pipeline
clf = pipeline("text-classification", model="dkuzmenko/self-harm-bert")clf("Can you recommend a good pasta recipe?")# [{'label': 'LABEL_0', 'score': 0.999}]```
Inputs longer than 512 tokens must be truncated or split.
## Intended use
Screening text for self-harm content, for example as one signal in a content moderation pipeline that sends flagged items to human review.
## Limitations
- **No published evaluation.** The model was trained in 2022 for a client project. The training data and the evaluation results were not released, so accuracy, false positive rate and false negative rate are not documented here. Measure them on your own data before you rely on the model.- **Language coverage is unverified.** The base model is multilingual, but that does not mean the classifier works in every language. In a small spot check it flagged English self-harm sentences and missed a Ukrainian one. Treat non-English input as untested.- **It classifies text, not people.** A positive label means the text resembles self-harm content in the training data. It is not a risk assessment of the author and must not be used as a clinical or diagnostic tool.- **Errors go both ways.** It can miss indirect or coded language, and it can flag quotes, fiction, news or recovery stories. Do not use it as the only basis for an automated action against a user, and do not use it as the only safeguard for a person who may be at risk.
## Training
- Base model: [`google-bert/bert-base-multilingual-uncased`](https://huggingface.co/google-bert/bert-base-multilingual-uncased)- Task: single-label classification, 2 classes- Framework: `transformers` 4.25.1, PyTorch
## License
MIT for the fine-tuned weights and files in this repository. The base model is released by Google under Apache 2.0.
## If you need help
If you or someone you know is thinking about self-harm, contact a local emergency number or a crisis line. [findahelpline.com](https://findahelpline.com) lists services by country.LICENSEAdded+21
README.mdAdded+58