BioBERT Embeddings (Discharge)


This model contains a pre-trained weights of ClinicalBERT for discharge summaries. This domain-specific model has performance improvements on 3/5 clinical NLP tasks andd establishing a new state-of-the-art on the MedNLI dataset. The details are described in the paper “Publicly Available Clinical BERT Embeddings”.


How to use

embeddings = BertEmbeddings.pretrained("biobert_discharge_base_cased", "en") \
      .setInputCols("sentence", "token") \
nlp_pipeline = Pipeline(stages=[document_assembler, sentence_detector, tokenizer, embeddings])
pipeline_model =[[""]]).toDF("text"))
result = pipeline_model.transform(spark.createDataFrame(pd.DataFrame({"text": ["I hate cancer"]})))
val embeddings = BertEmbeddings.pretrained("biobert_discharge_base_cased", "en")
      .setInputCols("sentence", "token")
val pipeline = new Pipeline().setStages(Array(document_assembler, sentence_detector, tokenizer, embeddings))
val result =["I hate cancer"].toDS.toDF("text")).transform(data)
import nlu

text = ["I hate cancer"]
embeddings_df = nlu.load('en.embed.biobert.discharge_base_cased').predict(text, output_level='token')


        token	en_embed_biobert_discharge_base_cased_embeddings

	I	[0.0036486536264419556, 0.3796533942222595, -0...
	hate	[0.1914958357810974, 0.6709488034248352, -0.49...
	cancer	[0.04618441313505173, -0.04562612622976303, -0...

Model Information

Model Name: biobert_discharge_base_cased
Type: embeddings
Compatibility: Spark NLP 2.6.0
License: Open Source
Edition: Official
Input Labels: [sentence, token]
Output Labels: [word_embeddings]
Language: [en]
Dimension: 768
Case sensitive: true

Data Source

The model is imported from