Feature Extraction
Transformers
Safetensors
English
roberta
biomedical
clinical
cardiology
entity-linking
concept-normalization
umls
metric-learning
text-embeddings-inference
Instructions to use DT4H/CardioBERTa.en_GP_enriched with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DT4H/CardioBERTa.en_GP_enriched with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="DT4H/CardioBERTa.en_GP_enriched")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("DT4H/CardioBERTa.en_GP_enriched") model = AutoModel.from_pretrained("DT4H/CardioBERTa.en_GP_enriched", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Release CardioBERTa-based clinical concept disambiguation model
Browse files- README.md +91 -0
- config.json +27 -0
- merges.txt +0 -0
- model.safetensors +3 -0
- special_tokens_map.json +51 -0
- tokenizer.json +0 -0
- tokenizer_config.json +59 -0
- training_config.json +22 -0
- training_data_stats.json +31 -0
- triplet_comparison.csv +4 -0
- vocab.json +0 -0
README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
library_name: transformers
|
| 5 |
+
pipeline_tag: feature-extraction
|
| 6 |
+
base_model: DT4H/CardioBERTa.en
|
| 7 |
+
tags:
|
| 8 |
+
- biomedical
|
| 9 |
+
- clinical
|
| 10 |
+
- cardiology
|
| 11 |
+
- entity-linking
|
| 12 |
+
- concept-normalization
|
| 13 |
+
- umls
|
| 14 |
+
- metric-learning
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# DT4H_CardioBERTa_grandparents_en_enriched
|
| 18 |
+
|
| 19 |
+
`DT4H_CardioBERTa_grandparents_en_enriched` is a English biomedical terminology encoder for **clinical concept normalization and entity linking**. It is initialized from [`DT4H/CardioBERTa.en`] and specialized using CUI-supervised terminology pairs and metric learning.
|
| 20 |
+
|
| 21 |
+
## Backbone
|
| 22 |
+
|
| 23 |
+
The backbone belongs to the **CardioBERTa** family from *CardioLM - a multilingual suite of small language models for the cardiology domain*. CardioBERTa comprises language-specific encoder models adapted to cardiology through continued pretraining on monolingual biomedical and cardiology-related corpora using Masked Language Modeling (MLM). The family covers Czech, Dutch, English, Italian, Romanian, Spanish and Swedish.
|
| 24 |
+
|
| 25 |
+
## Training
|
| 26 |
+
|
| 27 |
+
| | |
|
| 28 |
+
|---|---|
|
| 29 |
+
| Language | English (`en`) |
|
| 30 |
+
| Triplet collection | `enriched` |
|
| 31 |
+
| Strategy | `grandparents` |
|
| 32 |
+
| Objective | Multi-Similarity Loss |
|
| 33 |
+
| Mining | All triplets, margin 0.2 |
|
| 34 |
+
| Pooling | CLS |
|
| 35 |
+
| Epochs | 1 |
|
| 36 |
+
| Batch size | 256 |
|
| 37 |
+
| Learning rate | 2e-5 |
|
| 38 |
+
| Max. length | 25 |
|
| 39 |
+
|
| 40 |
+
CUI-supervised terminology pairs enriched with grandparent-level ontology relations.
|
| 41 |
+
|
| 42 |
+
### Terminology statistics
|
| 43 |
+
|
| 44 |
+
| Strategy | Triplets | CUIs | Unique terms | Unique positives | Terms/CUI | Δ terms |
|
| 45 |
+
|---|---:|---:|---:|---:|---:|---:|
|
| 46 |
+
| synonyms | 83,914 | 83,914 | 165,661 | 83,472 | 2.00 | 0 |
|
| 47 |
+
| parents | 1,699,553 | 477,290 | 550,651 | 432,552 | 4.03 | +384,990 |
|
| 48 |
+
| grandparents | 4,952,020 | 477,293 | 550,651 | 485,607 | 10.06 | +384,990 |
|
| 49 |
+
|
| 50 |
+
This model uses **4,952,020 triplets**, covering **477,293 CUIs** and **550,651 unique normalized terms**.
|
| 51 |
+
|
| 52 |
+
The training terminology is **not distributed** with this repository because it contains resources subject to UMLS licensing conditions. Only aggregate statistics are released.
|
| 53 |
+
|
| 54 |
+
## Intended use
|
| 55 |
+
|
| 56 |
+
The model is intended for terminology embedding, biomedical candidate retrieval, concept normalization and entity linking, particularly in cardiology and clinical NLP pipelines. It is not intended for direct clinical decision-making.
|
| 57 |
+
|
| 58 |
+
## Usage
|
| 59 |
+
|
| 60 |
+
```python
|
| 61 |
+
import torch
|
| 62 |
+
import torch.nn.functional as F
|
| 63 |
+
from transformers import AutoModel, AutoTokenizer
|
| 64 |
+
|
| 65 |
+
model_id = "DT4H/DT4H_CardioBERTa_grandparents_en_enriched"
|
| 66 |
+
|
| 67 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 68 |
+
model = AutoModel.from_pretrained(model_id)
|
| 69 |
+
|
| 70 |
+
inputs = tokenizer(
|
| 71 |
+
"clinical concept",
|
| 72 |
+
return_tensors="pt",
|
| 73 |
+
truncation=True,
|
| 74 |
+
max_length=25,
|
| 75 |
+
)
|
| 76 |
+
|
| 77 |
+
with torch.no_grad():
|
| 78 |
+
output = model(**inputs)
|
| 79 |
+
|
| 80 |
+
embedding = F.normalize(
|
| 81 |
+
output.last_hidden_state[:, 0, :],
|
| 82 |
+
p=2,
|
| 83 |
+
dim=1,
|
| 84 |
+
)
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
## Reference
|
| 88 |
+
|
| 89 |
+
**Danu et al.** *CardioLM - a multilingual suite of small language models for the cardiology domain*.
|
| 90 |
+
|
| 91 |
+
Developed within the **DataTools4Heart (DT4H)** project, Grant Agreement 101057849.
|
config.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "/mnt/home/users/gaias_001_uma/fgd/SapBERT/models/baseline/CardioBERTa.en",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"RobertaModel"
|
| 5 |
+
],
|
| 6 |
+
"attention_probs_dropout_prob": 0.1,
|
| 7 |
+
"bos_token_id": 0,
|
| 8 |
+
"classifier_dropout": null,
|
| 9 |
+
"eos_token_id": 2,
|
| 10 |
+
"hidden_act": "gelu",
|
| 11 |
+
"hidden_dropout_prob": 0.1,
|
| 12 |
+
"hidden_size": 768,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 3072,
|
| 15 |
+
"layer_norm_eps": 1e-05,
|
| 16 |
+
"max_position_embeddings": 514,
|
| 17 |
+
"model_type": "roberta",
|
| 18 |
+
"num_attention_heads": 12,
|
| 19 |
+
"num_hidden_layers": 12,
|
| 20 |
+
"pad_token_id": 1,
|
| 21 |
+
"position_embedding_type": "absolute",
|
| 22 |
+
"torch_dtype": "float32",
|
| 23 |
+
"transformers_version": "4.48.0",
|
| 24 |
+
"type_vocab_size": 1,
|
| 25 |
+
"use_cache": true,
|
| 26 |
+
"vocab_size": 50265
|
| 27 |
+
}
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8f26a53fd540e02f4c19a152dd6b30199a7c020dc69d585be949a07d08e68781
|
| 3 |
+
size 498604904
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": true,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"cls_token": {
|
| 10 |
+
"content": "<s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": true,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"eos_token": {
|
| 17 |
+
"content": "</s>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": true,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"mask_token": {
|
| 24 |
+
"content": "<mask>",
|
| 25 |
+
"lstrip": true,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
},
|
| 30 |
+
"pad_token": {
|
| 31 |
+
"content": "<pad>",
|
| 32 |
+
"lstrip": false,
|
| 33 |
+
"normalized": true,
|
| 34 |
+
"rstrip": false,
|
| 35 |
+
"single_word": false
|
| 36 |
+
},
|
| 37 |
+
"sep_token": {
|
| 38 |
+
"content": "</s>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": true,
|
| 41 |
+
"rstrip": false,
|
| 42 |
+
"single_word": false
|
| 43 |
+
},
|
| 44 |
+
"unk_token": {
|
| 45 |
+
"content": "<unk>",
|
| 46 |
+
"lstrip": false,
|
| 47 |
+
"normalized": true,
|
| 48 |
+
"rstrip": false,
|
| 49 |
+
"single_word": false
|
| 50 |
+
}
|
| 51 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"added_tokens_decoder": {
|
| 4 |
+
"0": {
|
| 5 |
+
"content": "<s>",
|
| 6 |
+
"lstrip": false,
|
| 7 |
+
"normalized": true,
|
| 8 |
+
"rstrip": false,
|
| 9 |
+
"single_word": false,
|
| 10 |
+
"special": true
|
| 11 |
+
},
|
| 12 |
+
"1": {
|
| 13 |
+
"content": "<pad>",
|
| 14 |
+
"lstrip": false,
|
| 15 |
+
"normalized": true,
|
| 16 |
+
"rstrip": false,
|
| 17 |
+
"single_word": false,
|
| 18 |
+
"special": true
|
| 19 |
+
},
|
| 20 |
+
"2": {
|
| 21 |
+
"content": "</s>",
|
| 22 |
+
"lstrip": false,
|
| 23 |
+
"normalized": true,
|
| 24 |
+
"rstrip": false,
|
| 25 |
+
"single_word": false,
|
| 26 |
+
"special": true
|
| 27 |
+
},
|
| 28 |
+
"3": {
|
| 29 |
+
"content": "<unk>",
|
| 30 |
+
"lstrip": false,
|
| 31 |
+
"normalized": true,
|
| 32 |
+
"rstrip": false,
|
| 33 |
+
"single_word": false,
|
| 34 |
+
"special": true
|
| 35 |
+
},
|
| 36 |
+
"50264": {
|
| 37 |
+
"content": "<mask>",
|
| 38 |
+
"lstrip": true,
|
| 39 |
+
"normalized": false,
|
| 40 |
+
"rstrip": false,
|
| 41 |
+
"single_word": false,
|
| 42 |
+
"special": true
|
| 43 |
+
}
|
| 44 |
+
},
|
| 45 |
+
"bos_token": "<s>",
|
| 46 |
+
"clean_up_tokenization_spaces": false,
|
| 47 |
+
"cls_token": "<s>",
|
| 48 |
+
"eos_token": "</s>",
|
| 49 |
+
"errors": "replace",
|
| 50 |
+
"extra_special_tokens": {},
|
| 51 |
+
"mask_token": "<mask>",
|
| 52 |
+
"max_len": 512,
|
| 53 |
+
"model_max_length": 512,
|
| 54 |
+
"pad_token": "<pad>",
|
| 55 |
+
"sep_token": "</s>",
|
| 56 |
+
"tokenizer_class": "RobertaTokenizer",
|
| 57 |
+
"trim_offsets": true,
|
| 58 |
+
"unk_token": "<unk>"
|
| 59 |
+
}
|
training_config.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"language": "en",
|
| 3 |
+
"strategy": "grandparents",
|
| 4 |
+
"triplets_type": "enriched",
|
| 5 |
+
"backbone": "DT4H/CardioBERTa.en",
|
| 6 |
+
"training": {
|
| 7 |
+
"objective": "Multi-Similarity Loss",
|
| 8 |
+
"pairwise": true,
|
| 9 |
+
"miner": {
|
| 10 |
+
"enabled": true,
|
| 11 |
+
"type_of_triplets": "all",
|
| 12 |
+
"margin": 0.2
|
| 13 |
+
},
|
| 14 |
+
"pooling": "cls",
|
| 15 |
+
"epochs": 1,
|
| 16 |
+
"batch_size": 256,
|
| 17 |
+
"learning_rate": 2e-05,
|
| 18 |
+
"max_length": 25,
|
| 19 |
+
"random_seed": 33
|
| 20 |
+
},
|
| 21 |
+
"training_data_availability": "Training terminology is not redistributed because it contains resources subject to UMLS licensing conditions."
|
| 22 |
+
}
|
training_data_stats.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"triplets": 4952020,
|
| 3 |
+
"malformed_rows": 0,
|
| 4 |
+
"unique_triplets": 4951542,
|
| 5 |
+
"duplicate_triplets": 478,
|
| 6 |
+
"unique_cuis": 477293,
|
| 7 |
+
"unique_anchors": 467097,
|
| 8 |
+
"unique_positives": 485607,
|
| 9 |
+
"unique_terms": 550651,
|
| 10 |
+
"unique_anchor_positive_pairs": 4915749,
|
| 11 |
+
"ambiguous_terms_across_cuis": 199127,
|
| 12 |
+
"self_pairs_exact": 0,
|
| 13 |
+
"self_pairs_normalized": 40,
|
| 14 |
+
"cuis_with_multiple_terms": 477293,
|
| 15 |
+
"terms_per_cui_mean": 10.059801840798,
|
| 16 |
+
"terms_per_cui_median": 7,
|
| 17 |
+
"terms_per_cui_p95": 28.0,
|
| 18 |
+
"terms_per_cui_max": 37,
|
| 19 |
+
"triplets_per_cui_mean": 10.375220252549273,
|
| 20 |
+
"triplets_per_cui_median": 7,
|
| 21 |
+
"triplets_per_cui_p95": 33.0,
|
| 22 |
+
"triplets_per_cui_max": 35,
|
| 23 |
+
"anchor_words_mean": 4.16947488095767,
|
| 24 |
+
"positive_words_mean": 4.407634056405265,
|
| 25 |
+
"cuis_common_with_synonyms": 83914,
|
| 26 |
+
"cuis_added_vs_synonyms": 393379,
|
| 27 |
+
"cuis_missing_vs_synonyms": 0,
|
| 28 |
+
"terms_common_with_synonyms": 165661,
|
| 29 |
+
"terms_added_vs_synonyms": 384990,
|
| 30 |
+
"terms_missing_vs_synonyms": 0
|
| 31 |
+
}
|
triplet_comparison.csv
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
strategy,triplets,unique_triplets,unique_cuis,unique_anchors,unique_positives,unique_terms,unique_anchor_positive_pairs,terms_per_cui_mean,terms_per_cui_median,cuis_added_vs_synonyms,cuis_missing_vs_synonyms,terms_added_vs_synonyms,terms_missing_vs_synonyms
|
| 2 |
+
synonyms,83914,83914,83914,83292,83472,165661,83798,1.9995709893462355,2.0,0,0,0,0
|
| 3 |
+
parents,1699553,1699259,477290,397180,432552,550651,1687484,4.028630392423893,3.0,393376,0,384990,0
|
| 4 |
+
grandparents,4952020,4951542,477293,467097,485607,550651,4915749,10.059801840798,7,393379,0,384990,0
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|