← Open Source
ncbi-nlp

bluebert

BlueBERT, pre-trained on PubMed abstracts and clinical notes (MIMIC-III).

ModelsDomain-specific modelsPython
Open on GitHub
Momentum
+0stars in 24 hours0.0%
600
Stars
80
Forks
+0
This week
3
Contributors
Created 2019-06-06 · Updated 2026-09-15 · #16305 today
Top developers
yfpengcskyan

ncbi-nlp/bluebert is ranked 16,305 with 600 stars.

Same-category comparison

ncbi-nlp/bluebert is ranked 16,305 among these 8 peers; naver/anny is ranked 16,304.

Same-category comparison
NameRankMetrics
facebookresearch/WSL-Images16,280
Language:
Python
Stars:
601
Forks:
62
Description:
Weakly Supervised Learning On Images.
shamangary/SSR-Net16,289
Language:
Python
Stars:
601
Forks:
146
Description:
[IJCAI18] SSR-Net: A Compact Soft Stagewise Regression Network for Age Estimation.
baaivision/tokenize-anything16,298
Language:
Jupyter Notebook
Stars:
600
Forks:
27
Description:
[ECCV 2024] Tokenize Anything via Prompting.
naver/anny16,304
Language:
Python
Stars:
600
Forks:
49
Description:
Anny, A Free and Interpretable Human Body Model for all ages, written in PyTorch.
MIV-XJTU/JanusVLN16,308
Language:
Python
Stars:
599
Forks:
42
Description:
[ICLR2026] Official implementation for "JanusVLN: Decoupling Semantics and Spatiality with Dual Implicit Memory for Vision-Language Navigation".
d-li14/mobilenetv3.pytorch16,333
Language:
Python
Stars:
598
Forks:
130
Description:
74.3% MobileNetV3-Large and 67.2% MobileNetV3-Small model on ImageNet.
JeffWang987/DriveDreamer16,348
Language:
Python
Stars:
597
Forks:
29
Description:
[ECCV 2024] DriveDreamer: Towards Real-world-driven World Models for Autonomous Driving.
sail-sg/MDT16,360
Language:
Python
Stars:
597
Forks:
42
Description:
Masked Diffusion Transformer is the SOTA for image synthesis. (ICCV 2023).
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguagePython
CategoryModels
SubcategoryDomain-specific models
KeywordsBiomedical
Stars600
Forks80
Contributors3
Created date2019-06-06
Updated date2026-09-15
Stars in 1 day0
Stars in 7 days0
Rank16,305
Previous rank16,095
Rank change-210
7-day stars rank15,459
Previous 7-day stars rank15,469
7-day stars rank change10
Total stars rank16,793
Previous total stars rank16,769
Total stars rank change-24
CountryUSA
README summary

BlueBERT **\*\*\*\*\* New Nov 1st, 2020: BlueBERT can be found at huggingface \*\*\*\*\*** **\*\*\*\*\* New Dec 5th, 2019: NCBI_BERT is renamed to BlueBERT \*\*\*\*\*** **\*\*\*\*\* New July 11th, 2019: preprocessed PubMed texts \*\*\*\*\*** We uploaded the preprocessed PubMed texts that were used to pre-train the BlueBERT models. Please refer to our paper Transfer Learning in Biomedical Natural Language Processing: An Evaluation of BERT and ELMo on Ten Benchmarking Datasets for more details. Pre-trained models and benchmark datasets The pre-trained BlueBERT weights, vocab

, and config files can be downloaded from: BlueBERT-Base, Uncased, PubMed: This model was pretrained on PubMed abstracts. BlueBERT-Base, Uncased, PubMed+MIMIC-III: This model was pretrained on PubMed abstracts and MIMIC-III. BlueBERT-Large, Uncased, PubMed: This model was pretrained on PubMed abstracts. BlueBERT-Large, Uncased, PubMed+MIMIC-III: This model was pretrained on PubMed abstracts and MIMIC-III. The pre-trained weights can also be found at Huggingface: The benchmark datasets can be downloaded from Fine-tuning

BlueBERT We assume the BlueBERT model has been downloaded at , and the dataset has been downloaded at . Sentence similarity Named Entity Recognition The task name can be : BC5CDR chemical or disease task : ShARe/CLEFE task Relation Extraction The task name can be : BC6 ChemProt task : DDI 2013 task : I2B2 2010 task Document multilabel classification Inference task Preprocessed PubMed texts We provide preprocessed PubMed texts that were used to pre-train the BlueBERT models. The corpus contains ~4000M words extracted from

the PubMed ASCII code version. Other operations include lowercasing the text removing speical chars - tokenizing the text using the NLTK Treebank tokenizer Below is a code snippet for more details. Pre-training with BERT Afterwards, we used the following code to generate pre-training data. We used the following code to train the BERT model. Please do not include if you are pre-training from scratch. Transfer Learning in Biomedical Natural Language Processing: An Evaluation of BERT and ELMo on

Ten Benchmarking Datasets. In *Proceedings of the Workshop on Biomedical Natural Language Processing (BioNLP)*. Acknowledgments This work was supported by the Intramural Research Programs of the National Institutes of Health, National Library of Medicine and Clinical Center. This work was supported by the National Library of Medicine of the National Institutes of Health under award number K99LM013001-01. We are also grateful to the authors of BERT and ELMo to make the data and codes publicly available. We would like

to thank Dr Sun Kim for processing the PubMed texts. Disclaimer This tool shows the results of research conducted in the Computational Biology Branch, NCBI. The information produced on this website is not intended for direct diagnostic use or medical decision-making without review and oversight by a clinical professional. Individuals should not change their health behavior solely on the basis of information produced on this website. NIH does not independently verify the validity or utility of the information produced

by this tool. If you have questions about the information produced on this website, please see a health care professional.

Frequently asked questions

How many stars and forks are recorded?

ncbi-nlp/bluebert has 600 stars and 80 forks.

What is the repository rank?

ncbi-nlp/bluebert is ranked 16,305.

What language and category are recorded?

ncbi-nlp/bluebert has 600 stars, uses Python and belongs to Models.

Which repository is closest in rank?

ncbi-nlp/bluebert is compared with naver/anny, ranked 16,304 with 600 stars.

README

BlueBERT

***** New Nov 1st, 2020: BlueBERT can be found at huggingface *****

***** New Dec 5th, 2019: NCBI_BERT is renamed to BlueBERT *****

***** New July 11th, 2019: preprocessed PubMed texts *****

We uploaded the preprocessed PubMed texts that were used to pre-train the BlueBERT models.


This repository provides codes and models of BlueBERT, pre-trained on PubMed abstracts and clinical notes (MIMIC-III). Please refer to our paper Transfer Learning in Biomedical Natural Language Processing: An Evaluation of BERT and ELMo on Ten Benchmarking Datasets for more details.

Pre-trained models and benchmark datasets

The pre-trained BlueBERT weights, vocab, and config files can be downloaded from:

The pre-trained weights can also be found at Huggingface:

The benchmark datasets can be downloaded from https://github.com/ncbi-nlp/BLUE_Benchmark

Fine-tuning BlueBERT

We assume the BlueBERT model has been downloaded at $BlueBERT_DIR, and the dataset has been downloaded at $DATASET_DIR.

Add local directory to $PYTHONPATH if needed.

export PYTHONPATH=.;$PYTHONPATH

Sentence similarity

python bluebert/run_bluebert_sts.py \
  --task_name='sts' \
  --do_train=true \
  --do_eval=false \
  --do_test=true \
  --vocab_file=$BlueBERT_DIR/vocab.txt \
  --bert_config_file=$BlueBERT_DIR/bert_config.json \
  --init_checkpoint=$BlueBERT_DIR/bert_model.ckpt \
  --max_seq_length=128 \
  --num_train_epochs=30.0 \
  --do_lower_case=true \
  --data_dir=$DATASET_DIR \
  --output_dir=$OUTPUT_DIR

Named Entity Recognition

python bluebert/run_bluebert_ner.py \
  --do_prepare=true \
  --do_train=true \
  --do_eval=true \
  --do_predict=true \
  --task_name="bc5cdr" \
  --vocab_file=$BlueBERT_DIR/vocab.txt \
  --bert_config_file=$BlueBERT_DIR/bert_config.json \
  --init_checkpoint=$BlueBERT_DIR/bert_model.ckpt \
  --num_train_epochs=30.0 \
  --do_lower_case=true \
  --data_dir=$DATASET_DIR \
  --output_dir=$OUTPUT_DIR

The task name can be

  • bc5cdr: BC5CDR chemical or disease task
  • clefe: ShARe/CLEFE task

Relation Extraction

python bluebert/run_bluebert.py \
  --do_train=true \
  --do_eval=false \
  --do_predict=true \
  --task_name="chemprot" \
  --vocab_file=$BlueBERT_DIR/vocab.txt \
  --bert_config_file=$BlueBERT_DIR/bert_config.json \
  --init_checkpoint=$BlueBERT_DIR/bert_model.ckpt \
  --num_train_epochs=10.0 \
  --data_dir=$DATASET_DIR \
  --output_dir=$OUTPUT_DIR \
  --do_lower_case=true 

The task name can be

  • chemprot: BC6 ChemProt task
  • ddi: DDI 2013 task
  • i2b2_2010: I2B2 2010 task

Document multilabel classification

python bluebert/run_bluebert_multi_labels.py \
  --task_name="hoc" \
  --do_train=true \
  --do_eval=true \
  --do_predict=true \
  --vocab_file=$BlueBERT_DIR/vocab.txt \
  --bert_config_file=$BlueBERT_DIR/bert_config.json \
  --init_checkpoint=$BlueBERT_DIR/bert_model.ckpt \
  --max_seq_length=128 \
  --train_batch_size=4 \
  --learning_rate=2e-5 \
  --num_train_epochs=3 \
  --num_classes=20 \
  --num_aspects=10 \
  --aspect_value_list="0,1" \
  --data_dir=$DATASET_DIR \
  --output_dir=$OUTPUT_DIR

Inference task

python bluebert/run_bluebert.py \
  --do_train=true \
  --do_eval=false \
  --do_predict=true \
  --task_name="mednli" \
  --vocab_file=$BlueBERT_DIR/vocab.txt \
  --bert_config_file=$BlueBERT_DIR/bert_config.json \
  --init_checkpoint=$BlueBERT_DIR/bert_model.ckpt \
  --num_train_epochs=10.0 \
  --data_dir=$DATASET_DIR \
  --output_dir=$OUTPUT_DIR \
  --do_lower_case=true 

Preprocessed PubMed texts

We provide preprocessed PubMed texts that were used to pre-train the BlueBERT models. The corpus contains ~4000M words extracted from the PubMed ASCII code version. Other operations include

Below is a code snippet for more details.

value = value.lower()
value = re.sub(r'[\r\n]+', ' ', value)
value = re.sub(r'[^\x00-\x7F]+', ' ', value)

tokenized = TreebankWordTokenizer().tokenize(value)
sentence = ' '.join(tokenized)
sentence = re.sub(r"\s's\b", "'s", sentence)

Pre-training with BERT

Afterwards, we used the following code to generate pre-training data. Please see https://github.com/google-research/bert for more details.

python bert/create_pretraining_data.py \
  --input_file=pubmed_uncased_sentence_nltk.txt \
  --output_file=pubmed_uncased_sentence_nltk.tfrecord \
  --vocab_file=bert_uncased_L-12_H-768_A-12_vocab.txt \
  --do_lower_case=True \
  --max_seq_length=128 \
  --max_predictions_per_seq=20 \
  --masked_lm_prob=0.15 \
  --random_seed=12345 \
  --dupe_factor=5

We used the following code to train the BERT model. Please do not include init_checkpoint if you are pre-training from scratch. Please see https://github.com/google-research/bert for more details.

python bert/run_pretraining.py \
  --input_file=pubmed_uncased_sentence_nltk.tfrecord \
  --output_dir=$BlueBERT_DIR \
  --do_train=True \
  --do_eval=True \
  --bert_config_file=$BlueBERT_DIR/bert_config.json \
  --init_checkpoint=$BlueBERT_DIR/bert_model.ckpt \
  --train_batch_size=32 \
  --max_seq_length=128 \
  --max_predictions_per_seq=20 \
  --num_train_steps=20000 \
  --num_warmup_steps=10 \
  --learning_rate=2e-5

Citing BlueBERT

@InProceedings{peng2019transfer,
  author    = {Yifan Peng and Shankai Yan and Zhiyong Lu},
  title     = {Transfer Learning in Biomedical Natural Language Processing: An Evaluation of BERT and ELMo on Ten Benchmarking Datasets},
  booktitle = {Proceedings of the 2019 Workshop on Biomedical Natural Language Processing (BioNLP 2019)},
  year      = {2019},
  pages     = {58--65},
}

Acknowledgments

This work was supported by the Intramural Research Programs of the National Institutes of Health, National Library of Medicine and Clinical Center. This work was supported by the National Library of Medicine of the National Institutes of Health under award number K99LM013001-01.

We are also grateful to the authors of BERT and ELMo to make the data and codes publicly available.

We would like to thank Dr Sun Kim for processing the PubMed texts.

Disclaimer

This tool shows the results of research conducted in the Computational Biology Branch, NCBI. The information produced on this website is not intended for direct diagnostic use or medical decision-making without review and oversight by a clinical professional. Individuals should not change their health behavior solely on the basis of information produced on this website. NIH does not independently verify the validity or utility of the information produced by this tool. If you have questions about the information produced on this website, please see a health care professional. More information about NCBI's disclaimer policy is available.

Nearby in the ranking
Similar items