bioner_nlmchem

This is a named entity recognition model fine-tuned from the microsoft/BiomedNLP-BiomedBERT-base-uncased-abstract-fulltext model. It predicts spans with only 1 possible label (Chemical).

The code used for training this model can be found at https://github.com/Glasgow-AI4BioMed/bioner along with links to other biomedical NER models trained on well-known biomedical corpora. The source dataset information is below.

Example Usage

The code below will load up the model and apply it to the provided text. It uses a simple aggregation strategy to post-process the individual tokens into larger multi-token entities where needed.

from transformers import pipeline

# Load the model as part of an NER pipeline
ner_pipeline = pipeline("token-classification", 
                        model="Glasgow-AI4BioMed/bioner_nlmchem",
                        aggregation_strategy="max")

# Apply it to some text
ner_pipeline("EGFR T790M mutations have been known to affect treatment outcomes for NSCLC patients receiving erlotinib.")

# Output:
# [ {"entity_group": "Chemical", "score": 0.99909, "word": "erlotinib", "start": 76, "end": 85} ]

Dataset Info

Source: The NLM-Chem dataset was downloaded from: https://ftp.ncbi.nlm.nih.gov/pub/lu/NLMChem/

The dataset should be cited with: Islamaj, Rezarta, et al. "NLM-Chem, a new resource for chemical entity recognition in PubMed full text literature." Scientific data 8.1 (2021): 91. DOI: 10.1038/s41597-021-00875-16

Preprocessing: The training/validation/test split was maintained from the original dataset. The annotations were filtered down to only 'Chemical'. The preprocessing script for this dataset is prepare_nlmchem.py.

Performance

The span-level performance on the test split for the different labels are shown in the tables below. The full performance results are available in the model repo in Markdown format for viewing and JSON format for easier loading. These include the performance at token level (with individual B- and I- labels as the token classifier uses IOB2 token labelling).

Label Precision Recall F1-score Support
Chemical 0.842 0.846 0.844 11139
macro avg 0.842 0.846 0.844 11139
weighted avg 0.842 0.846 0.844 11139

Hyperparameters

Hyperparameter tuning was done with optuna and the hyperparameter_search functionality. 100 trials were run. Early stopping was applied during training. The best performing model was selected using the macro F1 performance on the validation set. The selected hyperparameters are in the table below.

Hyperparameter Value
epochs 8.0
learning_rate 1.3683780119915452e-05
per_device_train_batch_size 16
weight_decay 0.29224559914287757
warmup_ratio 0.1369955905099
Downloads last month
3
Safetensors
Model size
109M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Glasgow-AI4BioMed/bioner_nlmchem

Collection including Glasgow-AI4BioMed/bioner_nlmchem