Fine-tuned version of
mental-bert-base-uncased
for 4-class mental health severity classification.
Built as part of the EchoCare project (M1 — NLP Core).
1from transformers import BertTokenizerFast, BertForSequenceClassification
2import torch
3
4tokenizer = BertTokenizerFast.from_pretrained("Aalia-Laghari/hamdardai-bert")
5model = BertForSequenceClassification.from_pretrained("Aalia-Laghari/hamdardai-bert")
6model.eval()
7
8text = "I haven't left my room in days and nothing feels real anymore"
9inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
10
11with torch.no_grad():
12 logits = model(**inputs).logits
13 pred = logits.argmax(dim=-1).item()
14
15labels = ["Low", "Medium", "High", "Crisis"]
16print(labels[pred])
Research and educational purposes as part of the EchoCare mental health support application.
Not intended for clinical diagnosis or standalone mental health intervention.