Text Classification
Transformers
Safetensors
PyTorch
English
bert
biomedical
psynamic
text-embeddings-inference
Instructions to use STRIDE-lab/biobert-setting-20261106 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use STRIDE-lab/biobert-setting-20261106 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="STRIDE-lab/biobert-setting-20261106")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("STRIDE-lab/biobert-setting-20261106") model = AutoModelForSequenceClassification.from_pretrained("STRIDE-lab/biobert-setting-20261106", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
base_model: dmis-lab/biobert-v1.1
|
| 4 |
+
tags:
|
| 5 |
+
- transformers
|
| 6 |
+
- pytorch
|
| 7 |
+
- biomedical
|
| 8 |
+
- text-classification
|
| 9 |
+
- psynamic
|
| 10 |
+
license: apache-2.0
|
| 11 |
+
language:
|
| 12 |
+
- en
|
| 13 |
+
pipeline_tag: text-classification
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# biobert-setting-20261106
|
| 17 |
+
|
| 18 |
+
Fine-tuned model from the PsyNamic project ([code](https://github.com/Ineichen-Group/PsyNamic), [webapp](https://psynamic.dcr.unibe.ch)): Setting.
|
| 19 |
+
This is the model deployed in the PsyNamic webapp after the revision (Nov 2026). It supersedes [STRIDE-lab/pubmedbert-setting-20250221](https://huggingface.co/STRIDE-lab/pubmedbert-setting-20250221) (tag `submission-v1`, initial submission).
|
| 20 |
+
|
| 21 |
+
## Base Model
|
| 22 |
+
|
| 23 |
+
`dmis-lab/biobert-v1.1`
|
| 24 |
+
|
| 25 |
+
## Task
|
| 26 |
+
|
| 27 |
+
Setting
|
| 28 |
+
|
| 29 |
+
## Labels (id2label)
|
| 30 |
+
|
| 31 |
+
| ID | Label |
|
| 32 |
+
|---|---|
|
| 33 |
+
| 0 | Clinical |
|
| 34 |
+
| 1 | Naturalistic |
|
| 35 |
+
| 2 | Party setting |
|
| 36 |
+
| 3 | Other setting |
|
| 37 |
+
| 4 | Unknown |
|
| 38 |
+
| 5 | Not applicable |
|
| 39 |
+
| 6 | Palliative Setting |
|
| 40 |
+
|
| 41 |
+
## Prediction rule
|
| 42 |
+
|
| 43 |
+
Multi-label: a sigmoid is applied per label, and every label with probability **≥ 0.12** is predicted. This is the threshold used in the PsyNamic webapp. It was tuned on the validation set with a pre-specified rule: start at the threshold with maximal weighted F1, then lower it as long as weighted precision stays within 0.05 of its value there.
|
| 44 |
+
|
| 45 |
+
## Model selection
|
| 46 |
+
|
| 47 |
+
Five base models (BiomedBERT-abstract, BioBERT, BioLinkBERT, ClinicalBERT, SciBERT) were fine-tuned with identical hyperparameters. The checkpoint is the one with the lowest validation loss (early stopping), and the base model was selected on the validation set (weighted F1). The test set was used once, after selection.
|
| 48 |
+
|
| 49 |
+
## Test Performance
|
| 50 |
+
|
| 51 |
+
Held-out test set (98 abstracts), tuned threshold as in the webapp, 95% bootstrap CIs (1,000 BCa resamples).
|
| 52 |
+
|
| 53 |
+
| Metric (test) | Value [95% CI] |
|
| 54 |
+
|---|---|
|
| 55 |
+
| **Weighted F1** | **0.850 [0.762–0.906]** |
|
| 56 |
+
| Weighted precision | 0.820 [0.720–0.882] |
|
| 57 |
+
| Weighted recall | 0.891 [0.814–0.942] |
|
| 58 |
+
|
| 59 |
+
## Usage
|
| 60 |
+
|
| 61 |
+
```python
|
| 62 |
+
import torch
|
| 63 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 64 |
+
|
| 65 |
+
repo = "STRIDE-lab/biobert-setting-20261106"
|
| 66 |
+
tokenizer = AutoTokenizer.from_pretrained(repo)
|
| 67 |
+
model = AutoModelForSequenceClassification.from_pretrained(repo)
|
| 68 |
+
inputs = tokenizer("<title>. <abstract>", truncation=True, max_length=512, return_tensors="pt")
|
| 69 |
+
logits = model(**inputs).logits
|
| 70 |
+
probs = torch.sigmoid(logits)[0]
|
| 71 |
+
pred = [model.config.id2label[i] for i, p in enumerate(probs) if p >= 0.12]
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
## Training Parameters
|
| 75 |
+
|
| 76 |
+
```json
|
| 77 |
+
{
|
| 78 |
+
"data": "<private_dataset>",
|
| 79 |
+
"task": "Setting",
|
| 80 |
+
"model": "biobert",
|
| 81 |
+
"cross_val": false,
|
| 82 |
+
"batch_size": 8,
|
| 83 |
+
"learning_rate": 5e-05,
|
| 84 |
+
"weight_decay": 0.01,
|
| 85 |
+
"lr_scheduler": "linear",
|
| 86 |
+
"warmup_ratio": 0.1,
|
| 87 |
+
"epochs": 30,
|
| 88 |
+
"dropout": 0.1,
|
| 89 |
+
"early_stopping_patience": 5,
|
| 90 |
+
"gradient_clipping": 1.0,
|
| 91 |
+
"max_length": 512,
|
| 92 |
+
"threshold": 0.5,
|
| 93 |
+
"is_multilabel": true
|
| 94 |
+
}
|
| 95 |
+
```
|