Instructions to use LucyTD/DysphorBERT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LucyTD/DysphorBERT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("fill-mask", model="LucyTD/DysphorBERT")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("LucyTD/DysphorBERT") model = AutoModelForMaskedLM.from_pretrained("LucyTD/DysphorBERT", device_map="auto") - Notebooks
- Google Colab
- Kaggle
DysphorBERT (v1 · depresion+trans)
DysphorBERT is a domain-adapted Masked Language Model (MLM) built by continuing the pretraining of citiusLTL/DisorBERT on 1,441,325 cleaned English posts (297.4M tokens) from seven transgender-focused Reddit communities (2009–2025, sourced from Arctic Shift monthly archives).
Developed as a Master's graduate project at CICESE (Inducción a la Ciencia de Datos, Ensenada, B.C., Mexico) by Lucy Torres Durante.
Model Details
- Base model:
citiusLTL/DisorBERT(BERT-base, 110M parameters, WordPiece). - Adaptation method: 1 epoch (~18,152 steps, 256-token packed blocks, effective batch size 64, AdamW,
lr=3e-5, 6% warmup,bf16) using whole-word guided masking (CollatorGuiado) over two disjoint lexicons: 126 depression terms (p=1.0) and 274 trans-community terms (p=0.7, expanded via log2-ratio keyness and Dunning's $G^2$). - Strict anti-leakage: all 1,400 evaluation posts from
T-Risk, 48 SHA-1 text collisions, and 21,277 additional posts from their 1,347 authors were removed before MLM training.
Evaluation Summary
| Benchmark / Metric | DisorBERT base |
MLM-ninguno (ablation) |
DysphorBERT v1 |
|---|---|---|---|
| MLM Neutral PPL (15%) | 35.66 |
4.47 |
4.60 (−87%) |
| MLM Held-out Cloze $\Delta$LP (6 terms) | 0.00 |
+0.11 (2/6) |
+0.64 (4/6) |
| eRisk 2024 (21 BDI-II symptoms) Macro-F1 | 0.877 ± 0.048 |
0.884 ± 0.056 |
0.890 ± 0.051 |
| eRisk 2024 Macro PR-AUC | 0.949 ± 0.039 |
0.949 ± 0.038 |
0.955 ± 0.033 |
| T-Risk (5-fold CV by author, pop.-weighted) PR-AUC | 0.711 [0.617, 0.795] |
0.792 [0.721, 0.855] |
0.801 [0.733, 0.862] ($p < 0.001$) |
| T-Risk (5-fold CV by author, pop.-weighted) F1 | 0.683 [0.602, 0.750] |
0.735 [0.668, 0.797] |
0.748 [0.679, 0.807] ($p = 0.032$) |
| T-Risk BDI-21 zero-shot (180 pos.) Macro ROC-AUC | 0.573 |
0.602 |
0.637 |
(Note: in T-Risk B2, the difference between DysphorBERT v1 and the random-masking ablation MLM-ninguno is $+0.009$ PR-AUC, $p = 0.324$, indicating that domain exposure to the 297.4M-token corpus drives most of the downstream gain.)
Usage
from transformers import AutoModelForMaskedLM, AutoTokenizer, pipeline
model_id = "LucyTD/DysphorBERT"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForMaskedLM.from_pretrained(model_id)
fill = pipeline("fill-mask", model=model, tokenizer=tok, top_k=5)
print(fill("My [MASK] has been so bad I cannot leave the house."))
For downstream depression / BDI-II classification, load with AutoModel or AutoModelForSequenceClassification and fine-tune on labeled data.
Limitations, Ethics & License
- Research use only — NOT a clinical tool: this model detects linguistic patterns of depressive distress in self-selected English Reddit posts and cannot be used for clinical diagnosis, medical advice, or epidemiological prevalence estimation.
- Scope & bias: trained exclusively on seven English-language Reddit communities; evaluated on a single-annotator stratified benchmark (
T-Risk, $n=1{,}400$). No raw Reddit posts are redistributed. - License: inherits
CC BY-NC 4.0(non-commercial) fromcitiusLTL/DisorBERT(Aragón et al., ACL 2023).
Citation
If you use this model, please cite DisorBERT (Aragón et al., ACL 2023) and this project repository:
@inproceedings{aragon2023disorbert,
author = {Arag{\'o}n, Mario Ezra and L{\'o}pez-Monroy, Adri{\'a}n Pastor and Gonz{\'a}lez, Luis Carlos and Losada, David E. and Montes-y-G{\'o}mez, Manuel},
title = {{DisorBERT}: A Double Domain Adaptation Model for Detecting Signs of Mental Disorders in Social Media},
booktitle = {Proceedings of ACL 2023 (Volume 1: Long Papers)},
year = {2023},
pages = {15305--15318},
doi = {10.18653/v1/2023.acl-long.853}
}
- Downloads last month
- 15
Model tree for LucyTD/DysphorBERT
Base model
citiusLTL/DisorBERT