Downloads · 30 days
129
5% of all-time downloads
Akashpaul123/bert-suicide-detection
bert-suicide-detection is a text classification model from Akashpaul123. Use it when you need a label for a piece of text. The card lists the license as mit.
This is a fine-tuned BERT model for suicide risk detection in text. The model can classify text as either "suicide" (indicating potential suicide risk) or "non-suicide" (indicating no immediate risk).
Downloads · 30 days
129
5% of all-time downloads
All-time downloads
2.4K
Public
Parameters
109M
438 MB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors438 MB · 100%
From the Hugging Face model README
This is a fine-tuned BERT model for suicide risk detection in text. The model can classify text as either "suicide" (indicating potential suicide risk) or "non-suicide" (indicating no immediate risk).
This model is designed to assist mental health professionals and support systems in identifying potentially at-risk individuals. It should NOT be used as a standalone diagnostic tool.
from transformers import BertTokenizer, BertForSequenceClassification
import torch
# Load model and tokenizer
model_name = "Akashpaul123/bert-suicide-detection"
tokenizer = BertTokenizer.from_pretrained(model_name)
model = BertForSequenceClassification.from_pretrained(model_name)
# Example usage
text = "I'm feeling really down and don't know if I can keep going."
inputs = tokenizer(text, return_tensors="pt", max_length=512, truncation=True, padding=True)
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
suicide_prob = predictions[0][1].item()
non_suicide_prob = predictions[0][0].item()
print(f"Suicide probability: {suicide_prob:.4f}")
print(f"Non-suicide probability: {non_suicide_prob:.4f}")
The model was trained on the Suicide Detection dataset containing 232,074 samples with balanced classes (50% suicide, 50% non-suicide).
⚠️ Important Notice: This model is a tool to assist in suicide risk assessment and should not replace professional mental health evaluation. Always consult with qualified mental health professionals for proper assessment and intervention.
This model is released under the MIT License.
If you use this model in your research, please cite:
@model{akashpaul2024bert-suicide-detection,
title={BERT Suicide Risk Detection Model},
author={Akash Paul},
year={2024},
url={https://huggingface.co/Akashpaul123/bert-suicide-detection}
}
For questions or issues, please contact through the Hugging Face model page.