How to use from the
Use from the
Transformers library
# 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")
Quick Links

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

from 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

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 lists services by country.

Downloads last month
19
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for dkuzmenko/self-harm-bert

Finetuned
(1,836)
this model