Feature Extraction
Transformers
Safetensors
Swedish
bert
biomedical
clinical
cardiology
entity-linking
concept-normalization
umls
metric-learning
text-embeddings-inference
Instructions to use DT4H/CardioBERTa.sv_translations_only with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DT4H/CardioBERTa.sv_translations_only with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="DT4H/CardioBERTa.sv_translations_only")# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("DT4H/CardioBERTa.sv_translations_only") model = AutoModel.from_pretrained("DT4H/CardioBERTa.sv_translations_only", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Release CardioBERTa-based clinical concept disambiguation model
Browse files- README.md +91 -0
- config.json +27 -0
- model.safetensors +3 -0
- special_tokens_map.json +37 -0
- tokenizer.json +0 -0
- tokenizer_config.json +58 -0
- training_config.json +22 -0
- training_data_stats.json +31 -0
- triplet_comparison.csv +4 -0
- vocab.txt +0 -0
README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- sv
|
| 4 |
+
library_name: transformers
|
| 5 |
+
pipeline_tag: feature-extraction
|
| 6 |
+
base_model: DT4H/CardioBERTa.sv
|
| 7 |
+
tags:
|
| 8 |
+
- biomedical
|
| 9 |
+
- clinical
|
| 10 |
+
- cardiology
|
| 11 |
+
- entity-linking
|
| 12 |
+
- concept-normalization
|
| 13 |
+
- umls
|
| 14 |
+
- metric-learning
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# DT4H_CardioBERTa_sv_translations_only
|
| 18 |
+
|
| 19 |
+
`DT4H_CardioBERTa_sv_translations_only` is a Swedish biomedical terminology encoder for **clinical concept normalization and entity linking**. It is initialized from [`DT4H/CardioBERTa.sv`] 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 | Swedish (`sv`) |
|
| 30 |
+
| Triplet collection | `translations_only` |
|
| 31 |
+
| Strategy | `synonyms` |
|
| 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 synonym pairs.
|
| 41 |
+
|
| 42 |
+
### Terminology statistics
|
| 43 |
+
|
| 44 |
+
| Strategy | Triplets | CUIs | Unique terms | Unique positives | Terms/CUI | Δ terms |
|
| 45 |
+
|---|---:|---:|---:|---:|---:|---:|
|
| 46 |
+
| synonyms | 71,919 | 71,919 | 141,369 | 71,328 | 2.00 | 0 |
|
| 47 |
+
| parents | 1,609,325 | 476,238 | 531,269 | 406,618 | 3.94 | +389,900 |
|
| 48 |
+
| grandparents | 4,725,159 | 476,971 | 531,556 | 460,891 | 9.80 | +390,187 |
|
| 49 |
+
|
| 50 |
+
This model uses **71,919 triplets**, covering **71,919 CUIs** and **141,369 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_sv_translations_only"
|
| 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.sv",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"BertModel"
|
| 5 |
+
],
|
| 6 |
+
"attention_probs_dropout_prob": 0.1,
|
| 7 |
+
"classifier_dropout": null,
|
| 8 |
+
"gradient_checkpointing": false,
|
| 9 |
+
"hidden_act": "gelu",
|
| 10 |
+
"hidden_dropout_prob": 0.1,
|
| 11 |
+
"hidden_size": 768,
|
| 12 |
+
"initializer_range": 0.02,
|
| 13 |
+
"intermediate_size": 3072,
|
| 14 |
+
"layer_norm_eps": 1e-12,
|
| 15 |
+
"max_position_embeddings": 512,
|
| 16 |
+
"model_type": "bert",
|
| 17 |
+
"num_attention_heads": 12,
|
| 18 |
+
"num_hidden_layers": 12,
|
| 19 |
+
"output_past": true,
|
| 20 |
+
"pad_token_id": 0,
|
| 21 |
+
"position_embedding_type": "absolute",
|
| 22 |
+
"torch_dtype": "float32",
|
| 23 |
+
"transformers_version": "4.48.0",
|
| 24 |
+
"type_vocab_size": 2,
|
| 25 |
+
"use_cache": true,
|
| 26 |
+
"vocab_size": 50325
|
| 27 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:59362d150e06b7cd489ecd87069258c49339b1938789d4ee4c02092ffcb83b6d
|
| 3 |
+
size 498786152
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cls_token": {
|
| 3 |
+
"content": "[CLS]",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"mask_token": {
|
| 10 |
+
"content": "[MASK]",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "[PAD]",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"sep_token": {
|
| 24 |
+
"content": "[SEP]",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
},
|
| 30 |
+
"unk_token": {
|
| 31 |
+
"content": "[UNK]",
|
| 32 |
+
"lstrip": false,
|
| 33 |
+
"normalized": false,
|
| 34 |
+
"rstrip": false,
|
| 35 |
+
"single_word": false
|
| 36 |
+
}
|
| 37 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"added_tokens_decoder": {
|
| 3 |
+
"0": {
|
| 4 |
+
"content": "[PAD]",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false,
|
| 9 |
+
"special": true
|
| 10 |
+
},
|
| 11 |
+
"1": {
|
| 12 |
+
"content": "[UNK]",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false,
|
| 17 |
+
"special": true
|
| 18 |
+
},
|
| 19 |
+
"2": {
|
| 20 |
+
"content": "[CLS]",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false,
|
| 25 |
+
"special": true
|
| 26 |
+
},
|
| 27 |
+
"3": {
|
| 28 |
+
"content": "[SEP]",
|
| 29 |
+
"lstrip": false,
|
| 30 |
+
"normalized": false,
|
| 31 |
+
"rstrip": false,
|
| 32 |
+
"single_word": false,
|
| 33 |
+
"special": true
|
| 34 |
+
},
|
| 35 |
+
"4": {
|
| 36 |
+
"content": "[MASK]",
|
| 37 |
+
"lstrip": false,
|
| 38 |
+
"normalized": false,
|
| 39 |
+
"rstrip": false,
|
| 40 |
+
"single_word": false,
|
| 41 |
+
"special": true
|
| 42 |
+
}
|
| 43 |
+
},
|
| 44 |
+
"clean_up_tokenization_spaces": true,
|
| 45 |
+
"cls_token": "[CLS]",
|
| 46 |
+
"do_basic_tokenize": true,
|
| 47 |
+
"do_lower_case": false,
|
| 48 |
+
"extra_special_tokens": {},
|
| 49 |
+
"mask_token": "[MASK]",
|
| 50 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 51 |
+
"never_split": null,
|
| 52 |
+
"pad_token": "[PAD]",
|
| 53 |
+
"sep_token": "[SEP]",
|
| 54 |
+
"strip_accents": false,
|
| 55 |
+
"tokenize_chinese_chars": true,
|
| 56 |
+
"tokenizer_class": "BertTokenizer",
|
| 57 |
+
"unk_token": "[UNK]"
|
| 58 |
+
}
|
training_config.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"language": "sv",
|
| 3 |
+
"strategy": "synonyms",
|
| 4 |
+
"triplets_type": "translations_only",
|
| 5 |
+
"backbone": "DT4H/CardioBERTa.sv",
|
| 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": 71919,
|
| 3 |
+
"malformed_rows": 0,
|
| 4 |
+
"unique_triplets": 71919,
|
| 5 |
+
"duplicate_triplets": 0,
|
| 6 |
+
"unique_cuis": 71919,
|
| 7 |
+
"unique_anchors": 71096,
|
| 8 |
+
"unique_positives": 71328,
|
| 9 |
+
"unique_terms": 141369,
|
| 10 |
+
"unique_anchor_positive_pairs": 71821,
|
| 11 |
+
"ambiguous_terms_across_cuis": 2268,
|
| 12 |
+
"self_pairs_exact": 0,
|
| 13 |
+
"self_pairs_normalized": 37,
|
| 14 |
+
"cuis_with_multiple_terms": 71882,
|
| 15 |
+
"terms_per_cui_mean": 1.999485532334988,
|
| 16 |
+
"terms_per_cui_median": 2,
|
| 17 |
+
"terms_per_cui_p95": 2.0,
|
| 18 |
+
"terms_per_cui_max": 2,
|
| 19 |
+
"triplets_per_cui_mean": 1,
|
| 20 |
+
"triplets_per_cui_median": 1,
|
| 21 |
+
"triplets_per_cui_p95": 1.0,
|
| 22 |
+
"triplets_per_cui_max": 1,
|
| 23 |
+
"anchor_words_mean": 4.662286739248321,
|
| 24 |
+
"positive_words_mean": 5.321333722660215,
|
| 25 |
+
"cuis_common_with_synonyms": 71919,
|
| 26 |
+
"cuis_added_vs_synonyms": 0,
|
| 27 |
+
"cuis_missing_vs_synonyms": 0,
|
| 28 |
+
"terms_common_with_synonyms": 141369,
|
| 29 |
+
"terms_added_vs_synonyms": 0,
|
| 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,71919,71919,71919,71096,71328,141369,71821,1.999485532334988,2,0,0,0,0
|
| 3 |
+
parents,1609325,1609086,476238,389862,406618,531269,1592302,3.935698117327891,3.0,404319,0,389900,0
|
| 4 |
+
grandparents,4725159,4724753,476971,461115,460891,531556,4665781,9.803621184516459,7,405052,0,390187,0
|
vocab.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|