cristian-untaru commited on
Commit
abc6398
·
verified ·
1 Parent(s): 1f75a7f

Add frozen-encoder BioMedBERT medical triage model

Browse files
README.md ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ pipeline_tag: text-classification
4
+ base_model: microsoft/BiomedNLP-BiomedBERT-base-uncased-abstract-fulltext
5
+ tags:
6
+ - medical-triage
7
+ - text-classification
8
+ - peft
9
+ - frozen-encoder
10
+ - linear-probe
11
+ - sortmed
12
+ ---
13
+
14
+ # Frozen Encoder BioMedBERT Medical Triage
15
+
16
+ This model is a frozen-encoder sequence classifier for three-class medical
17
+ pre-triage classification. The pretrained encoder/backbone is kept frozen and
18
+ only the classification head is trained.
19
+
20
+ ## Base model
21
+
22
+ `microsoft/BiomedNLP-BiomedBERT-base-uncased-abstract-fulltext`
23
+
24
+ ## Task
25
+
26
+ The classifier predicts one of three triage labels:
27
+
28
+ - `self_monitor`
29
+ - `consult_gp`
30
+ - `urgent`
31
+
32
+ ## Adaptation method
33
+
34
+ - Method: Frozen Encoder + Trainable Classification Head
35
+ - Base encoder: frozen
36
+ - Trainable: classification head (+ pooler for BERT-style models)
37
+ - Max sequence length: 128
38
+ - Epochs: 8 (early stopping patience 3), best checkpoint by validation macro F1
39
+
40
+ ## Loading
41
+
42
+ This is a standard Transformers model and loads with the plain API
43
+ (no `trust_remote_code` required):
44
+
45
+ ```python
46
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer
47
+ tok = AutoTokenizer.from_pretrained("cristian-untaru/frozen-encoder-biomedbert-medical-triage")
48
+ model = AutoModelForSequenceClassification.from_pretrained("cristian-untaru/frozen-encoder-biomedbert-medical-triage")
49
+ ```
50
+
51
+ ## Test metrics
52
+
53
+ ```json
54
+ {
55
+ "eval_loss": 0.8381163477897644,
56
+ "eval_accuracy": 0.6038,
57
+ "eval_precision": 0.6201,
58
+ "eval_recall": 0.6058,
59
+ "eval_f1": 0.6107,
60
+ "eval_auc": 0.8076,
61
+ "eval_specificity": 0.7995,
62
+ "eval_iou": 0.4444
63
+ }
64
+ ```
65
+
66
+ This model is intended for academic experimentation and prototyping, not for
67
+ standalone clinical decision-making.
config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_cross_attention": false,
3
+ "architectures": [
4
+ "BertForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": null,
8
+ "classifier_dropout": null,
9
+ "dtype": "float32",
10
+ "eos_token_id": null,
11
+ "hidden_act": "gelu",
12
+ "hidden_dropout_prob": 0.1,
13
+ "hidden_size": 768,
14
+ "id2label": {
15
+ "0": "self_monitor",
16
+ "1": "consult_gp",
17
+ "2": "urgent"
18
+ },
19
+ "initializer_range": 0.02,
20
+ "intermediate_size": 3072,
21
+ "is_decoder": false,
22
+ "label2id": {
23
+ "consult_gp": 1,
24
+ "self_monitor": 0,
25
+ "urgent": 2
26
+ },
27
+ "layer_norm_eps": 1e-12,
28
+ "max_position_embeddings": 512,
29
+ "model_type": "bert",
30
+ "num_attention_heads": 12,
31
+ "num_hidden_layers": 12,
32
+ "pad_token_id": 0,
33
+ "problem_type": "single_label_classification",
34
+ "tie_word_embeddings": true,
35
+ "transformers_version": "5.12.0",
36
+ "type_vocab_size": 2,
37
+ "use_cache": false,
38
+ "vocab_size": 30522
39
+ }
label_map.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "label2id": {
3
+ "self_monitor": 0,
4
+ "consult_gp": 1,
5
+ "urgent": 2
6
+ },
7
+ "id2label": {
8
+ "0": "self_monitor",
9
+ "1": "consult_gp",
10
+ "2": "urgent"
11
+ }
12
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e8bbe2b168456f991aaa666c181f9cdc1a3e868955a9f9c69421414dbb85e1c0
3
+ size 437961724
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "cls_token": "[CLS]",
4
+ "do_lower_case": true,
5
+ "is_local": false,
6
+ "local_files_only": false,
7
+ "mask_token": "[MASK]",
8
+ "model_max_length": 128,
9
+ "pad_token": "[PAD]",
10
+ "sep_token": "[SEP]",
11
+ "strip_accents": null,
12
+ "tokenize_chinese_chars": true,
13
+ "tokenizer_class": "BertTokenizer",
14
+ "unk_token": "[UNK]"
15
+ }
training_config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "base_model": "microsoft/BiomedNLP-BiomedBERT-base-uncased-abstract-fulltext",
3
+ "adaptation_method": "Frozen Encoder + Trainable Classification Head",
4
+ "peft_type": "FROZEN_ENCODER",
5
+ "trainable_head_modules": [
6
+ "pooler",
7
+ "classifier"
8
+ ],
9
+ "num_labels": 3,
10
+ "max_length": 128,
11
+ "num_train_epochs": 8,
12
+ "learning_rate": 0.0002,
13
+ "batch_size_train": 16,
14
+ "batch_size_eval": 32,
15
+ "weight_decay": 0.01,
16
+ "warmup_ratio": 0.1,
17
+ "fp16": true,
18
+ "early_stopping_patience": 3,
19
+ "metric_for_best_model": "f1",
20
+ "train_size": 490,
21
+ "validation_size": 105,
22
+ "test_size": 106,
23
+ "hf_repo_id": "cristian-untaru/frozen-encoder-biomedbert-medical-triage"
24
+ }