fix file locations
Browse files- README.md +87 -3
- config.json +118 -0
- onnx/model.onnx +3 -0
- onnx/model_bnb4.onnx +3 -0
- onnx/model_int8.onnx +3 -0
- onnx/model_q4.onnx +3 -0
- onnx/model_q4f16.onnx +3 -0
- onnx/model_quantized.onnx +3 -0
- onnx/model_uint8.onnx +3 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- tokenizer.json +0 -0
- tokenizer_config.json +1 -0
- vocab.txt +0 -0
README.md
CHANGED
|
@@ -1,3 +1,87 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
thumbnail: "https://www.onebraveidea.org/wp-content/uploads/2019/07/OBI-Logo-Website.png"
|
| 5 |
+
tags:
|
| 6 |
+
- deidentification
|
| 7 |
+
- medical notes
|
| 8 |
+
- ehr
|
| 9 |
+
- phi
|
| 10 |
+
datasets:
|
| 11 |
+
- I2B2
|
| 12 |
+
metrics:
|
| 13 |
+
- F1
|
| 14 |
+
- Recall
|
| 15 |
+
- AUC
|
| 16 |
+
widget:
|
| 17 |
+
- text: "Physician Discharge Summary Admit date: 10/12/1982 Discharge date: 10/22/1982 Patient Information Jack Reacher, 54 y.o. male (DOB = 1/21/1928)."
|
| 18 |
+
- text: "Home Address: 123 Park Drive, San Diego, CA, 03245. Home Phone: 202-555-0199 (home)."
|
| 19 |
+
- text: "Hospital Care Team Service: Orthopedics Inpatient Attending: Roger C Kelly, MD Attending phys phone: (634)743-5135 Discharge Unit: HCS843 Primary Care Physician: Hassan V Kim, MD 512-832-5025."
|
| 20 |
+
license: mit
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
# Model Description
|
| 25 |
+
|
| 26 |
+
* A ClinicalBERT [[Alsentzer et al., 2019]](https://arxiv.org/pdf/1904.03323.pdf) model fine-tuned for de-identification of medical notes.
|
| 27 |
+
* Sequence Labeling (token classification): The model was trained to predict protected health information (PHI/PII) entities (spans). A list of protected health information categories is given by [HIPAA](https://www.hhs.gov/hipaa/for-professionals/privacy/laws-regulations/index.html).
|
| 28 |
+
* A token can either be classified as non-PHI or as one of the 11 PHI types. Token predictions are aggregated to spans by making use of BILOU tagging.
|
| 29 |
+
* The PHI labels that were used for training and other details can be found here: [Annotation Guidelines](https://github.com/obi-ml-public/ehr_deidentification/blob/master/AnnotationGuidelines.md)
|
| 30 |
+
* More details on how to use this model, the format of data and other useful information is present in the GitHub repo: [Robust DeID](https://github.com/obi-ml-public/ehr_deidentification).
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
# How to use
|
| 34 |
+
|
| 35 |
+
* A demo on how the model works (using model predictions to de-identify a medical note) is on this space: [Medical-Note-Deidentification](https://huggingface.co/spaces/obi/Medical-Note-Deidentification).
|
| 36 |
+
* Steps on how this model can be used to run a forward pass can be found here: [Forward Pass](https://github.com/obi-ml-public/ehr_deidentification/tree/master/steps/forward_pass)
|
| 37 |
+
* In brief, the steps are:
|
| 38 |
+
* Sentencize (the model aggregates the sentences back to the note level) and tokenize the dataset.
|
| 39 |
+
* Use the predict function of this model to gather the predictions (i.e., predictions for each token).
|
| 40 |
+
* Additionally, the model predictions can be used to remove PHI from the original note/text.
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
# Dataset
|
| 44 |
+
|
| 45 |
+
* The I2B2 2014 [[Stubbs and Uzuner, 2015]](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4978170/) dataset was used to train this model.
|
| 46 |
+
|
| 47 |
+
| | I2B2 | | I2B2 | |
|
| 48 |
+
| --------- | --------------------- | ---------- | -------------------- | ---------- |
|
| 49 |
+
| | TRAIN SET - 790 NOTES | | TEST SET - 514 NOTES | |
|
| 50 |
+
| PHI LABEL | COUNT | PERCENTAGE | COUNT | PERCENTAGE |
|
| 51 |
+
| DATE | 7502 | 43.69 | 4980 | 44.14 |
|
| 52 |
+
| STAFF | 3149 | 18.34 | 2004 | 17.76 |
|
| 53 |
+
| HOSP | 1437 | 8.37 | 875 | 7.76 |
|
| 54 |
+
| AGE | 1233 | 7.18 | 764 | 6.77 |
|
| 55 |
+
| LOC | 1206 | 7.02 | 856 | 7.59 |
|
| 56 |
+
| PATIENT | 1316 | 7.66 | 879 | 7.79 |
|
| 57 |
+
| PHONE | 317 | 1.85 | 217 | 1.92 |
|
| 58 |
+
| ID | 881 | 5.13 | 625 | 5.54 |
|
| 59 |
+
| PATORG | 124 | 0.72 | 82 | 0.73 |
|
| 60 |
+
| EMAIL | 4 | 0.02 | 1 | 0.01 |
|
| 61 |
+
| OTHERPHI | 2 | 0.01 | 0 | 0 |
|
| 62 |
+
| TOTAL | 17171 | 100 | 11283 | 100 |
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
# Training procedure
|
| 66 |
+
|
| 67 |
+
* Steps on how this model was trained can be found here: [Training](https://github.com/obi-ml-public/ehr_deidentification/tree/master/steps/train). The "model_name_or_path" was set to: "emilyalsentzer/Bio_ClinicalBERT".
|
| 68 |
+
* The dataset was sentencized with the en_core_sci_sm sentencizer from spacy.
|
| 69 |
+
* The dataset was then tokenized with a custom tokenizer built on top of the en_core_sci_sm tokenizer from spacy.
|
| 70 |
+
* For each sentence we added 32 tokens on the left (from previous sentences) and 32 tokens on the right (from the next sentences).
|
| 71 |
+
* The added tokens are not used for learning - i.e, the loss is not computed on these tokens - they are used as additional context.
|
| 72 |
+
* Each sequence contained a maximum of 128 tokens (including the 32 tokens added on). Longer sequences were split.
|
| 73 |
+
* The sentencized and tokenized dataset with the token level labels based on the BILOU notation was used to train the model.
|
| 74 |
+
* The model is fine-tuned from a pre-trained RoBERTa model.
|
| 75 |
+
|
| 76 |
+
* Training details:
|
| 77 |
+
* Input sequence length: 128
|
| 78 |
+
* Batch size: 32
|
| 79 |
+
* Optimizer: AdamW
|
| 80 |
+
* Learning rate: 4e-5
|
| 81 |
+
* Dropout: 0.1
|
| 82 |
+
|
| 83 |
+
# Results
|
| 84 |
+
|
| 85 |
+
# Questions?
|
| 86 |
+
|
| 87 |
+
Post a Github issue on the repo: [Robust DeID](https://github.com/obi-ml-public/ehr_deidentification).
|
config.json
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"BertForTokenClassification"
|
| 4 |
+
],
|
| 5 |
+
"attention_probs_dropout_prob": 0.1,
|
| 6 |
+
"finetuning_task": "ner",
|
| 7 |
+
"gradient_checkpointing": false,
|
| 8 |
+
"hidden_act": "gelu",
|
| 9 |
+
"hidden_dropout_prob": 0.1,
|
| 10 |
+
"hidden_size": 768,
|
| 11 |
+
"id2label": {
|
| 12 |
+
"0": "B-AGE",
|
| 13 |
+
"1": "B-DATE",
|
| 14 |
+
"2": "B-EMAIL",
|
| 15 |
+
"3": "B-HOSP",
|
| 16 |
+
"4": "B-ID",
|
| 17 |
+
"5": "B-LOC",
|
| 18 |
+
"6": "B-OTHERPHI",
|
| 19 |
+
"7": "B-PATIENT",
|
| 20 |
+
"8": "B-PATORG",
|
| 21 |
+
"9": "B-PHONE",
|
| 22 |
+
"10": "B-STAFF",
|
| 23 |
+
"11": "I-AGE",
|
| 24 |
+
"12": "I-DATE",
|
| 25 |
+
"13": "I-EMAIL",
|
| 26 |
+
"14": "I-HOSP",
|
| 27 |
+
"15": "I-ID",
|
| 28 |
+
"16": "I-LOC",
|
| 29 |
+
"17": "I-OTHERPHI",
|
| 30 |
+
"18": "I-PATIENT",
|
| 31 |
+
"19": "I-PATORG",
|
| 32 |
+
"20": "I-PHONE",
|
| 33 |
+
"21": "I-STAFF",
|
| 34 |
+
"22": "L-AGE",
|
| 35 |
+
"23": "L-DATE",
|
| 36 |
+
"24": "L-EMAIL",
|
| 37 |
+
"25": "L-HOSP",
|
| 38 |
+
"26": "L-ID",
|
| 39 |
+
"27": "L-LOC",
|
| 40 |
+
"28": "L-OTHERPHI",
|
| 41 |
+
"29": "L-PATIENT",
|
| 42 |
+
"30": "L-PATORG",
|
| 43 |
+
"31": "L-PHONE",
|
| 44 |
+
"32": "L-STAFF",
|
| 45 |
+
"33": "O",
|
| 46 |
+
"34": "U-AGE",
|
| 47 |
+
"35": "U-DATE",
|
| 48 |
+
"36": "U-EMAIL",
|
| 49 |
+
"37": "U-HOSP",
|
| 50 |
+
"38": "U-ID",
|
| 51 |
+
"39": "U-LOC",
|
| 52 |
+
"40": "U-OTHERPHI",
|
| 53 |
+
"41": "U-PATIENT",
|
| 54 |
+
"42": "U-PATORG",
|
| 55 |
+
"43": "U-PHONE",
|
| 56 |
+
"44": "U-STAFF"
|
| 57 |
+
},
|
| 58 |
+
"initializer_range": 0.02,
|
| 59 |
+
"intermediate_size": 3072,
|
| 60 |
+
"label2id": {
|
| 61 |
+
"B-AGE": 0,
|
| 62 |
+
"B-DATE": 1,
|
| 63 |
+
"B-EMAIL": 2,
|
| 64 |
+
"B-HOSP": 3,
|
| 65 |
+
"B-ID": 4,
|
| 66 |
+
"B-LOC": 5,
|
| 67 |
+
"B-OTHERPHI": 6,
|
| 68 |
+
"B-PATIENT": 7,
|
| 69 |
+
"B-PATORG": 8,
|
| 70 |
+
"B-PHONE": 9,
|
| 71 |
+
"B-STAFF": 10,
|
| 72 |
+
"I-AGE": 11,
|
| 73 |
+
"I-DATE": 12,
|
| 74 |
+
"I-EMAIL": 13,
|
| 75 |
+
"I-HOSP": 14,
|
| 76 |
+
"I-ID": 15,
|
| 77 |
+
"I-LOC": 16,
|
| 78 |
+
"I-OTHERPHI": 17,
|
| 79 |
+
"I-PATIENT": 18,
|
| 80 |
+
"I-PATORG": 19,
|
| 81 |
+
"I-PHONE": 20,
|
| 82 |
+
"I-STAFF": 21,
|
| 83 |
+
"L-AGE": 22,
|
| 84 |
+
"L-DATE": 23,
|
| 85 |
+
"L-EMAIL": 24,
|
| 86 |
+
"L-HOSP": 25,
|
| 87 |
+
"L-ID": 26,
|
| 88 |
+
"L-LOC": 27,
|
| 89 |
+
"L-OTHERPHI": 28,
|
| 90 |
+
"L-PATIENT": 29,
|
| 91 |
+
"L-PATORG": 30,
|
| 92 |
+
"L-PHONE": 31,
|
| 93 |
+
"L-STAFF": 32,
|
| 94 |
+
"O": 33,
|
| 95 |
+
"U-AGE": 34,
|
| 96 |
+
"U-DATE": 35,
|
| 97 |
+
"U-EMAIL": 36,
|
| 98 |
+
"U-HOSP": 37,
|
| 99 |
+
"U-ID": 38,
|
| 100 |
+
"U-LOC": 39,
|
| 101 |
+
"U-OTHERPHI": 40,
|
| 102 |
+
"U-PATIENT": 41,
|
| 103 |
+
"U-PATORG": 42,
|
| 104 |
+
"U-PHONE": 43,
|
| 105 |
+
"U-STAFF": 44
|
| 106 |
+
},
|
| 107 |
+
"layer_norm_eps": 1e-12,
|
| 108 |
+
"max_position_embeddings": 512,
|
| 109 |
+
"model_type": "bert",
|
| 110 |
+
"num_attention_heads": 12,
|
| 111 |
+
"num_hidden_layers": 12,
|
| 112 |
+
"pad_token_id": 0,
|
| 113 |
+
"position_embedding_type": "absolute",
|
| 114 |
+
"transformers_version": "4.6.1",
|
| 115 |
+
"type_vocab_size": 2,
|
| 116 |
+
"use_cache": true,
|
| 117 |
+
"vocab_size": 28996
|
| 118 |
+
}
|
onnx/model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:43b7a2d5f26e5f7adbc6d438398302c38c4686e710bbd93473a1e5c61eafcafa
|
| 3 |
+
size 431325444
|
onnx/model_bnb4.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1fcdae29c075ca986684a5d544cf46ba01ceed5d2773d0213f842a48059cd5dc
|
| 3 |
+
size 101
|
onnx/model_int8.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:90bbde06e370439cd0b9cf6759bd334131ab42aff249b97f0d869a7636df57a1
|
| 3 |
+
size 108643070
|
onnx/model_q4.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:db94e29d75410d7b5330b67a8a2e9129bf7176ba66f235d6a89974fd0391012f
|
| 3 |
+
size 99
|
onnx/model_q4f16.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b58a01284892fc12bfba83178a850b2064bec74ef2fbe03faac8de8a4ad5efa0
|
| 3 |
+
size 102
|
onnx/model_quantized.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:90bbde06e370439cd0b9cf6759bd334131ab42aff249b97f0d869a7636df57a1
|
| 3 |
+
size 108643070
|
onnx/model_uint8.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5d082c15d1e71120baa00e28023fe09e9e37484b4e8acf0770599cadd1af0c71
|
| 3 |
+
size 108643102
|
pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:842d9f0d394c71528bb73f87748c580a9a3ea82973a18e0871fd579e3eb21c6b
|
| 3 |
+
size 431100529
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"do_lower_case": false, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": null, "special_tokens_map_file": null, "do_basic_tokenize": true, "never_split": null}
|
vocab.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|