File size: 2,643 Bytes
e3997d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
license: mit
library_name: transformers
pipeline_tag: text-classification
base_model: google-bert/bert-base-multilingual-uncased
tags:
- 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

```python
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

- 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.