COVID BERT Sentence Embeddings (Large Uncased)

Description

BERT-large-uncased model, pretrained on a corpus of messages from Twitter about COVID-19.

Download

How to use

...
embeddings = BertEmbeddings.pretrained("sent_covidbert_large_uncased", "en") \
      .setInputCols("sentence") \
      .setOutputCol("sentence_embeddings")
nlp_pipeline = Pipeline(stages=[document_assembler, sentence_detector, embeddings])
pipeline_model = nlp_pipeline.fit(spark.createDataFrame([[""]]).toDF("text"))
result = pipeline_model.transform(spark.createDataFrame(pd.DataFrame({"text": ["I hate cancer, "Antibiotics aren't painkiller"]})))
...
val embeddings = BertEmbeddings.pretrained("sent_covidbert_large_uncased", "en")
      .setInputCols("sentence")
      .setOutputCol("sentence_embeddings")
val pipeline = new Pipeline().setStages(Array(document_assembler, sentence_detector, embeddings))
val result = pipeline.fit(Seq.empty["I hate cancer, "Antibiotics aren't painkiller"].toDS.toDF("text")).transform(data)
import nlu

text = ["I hate cancer", "Antibiotics aren't painkiller"]
embeddings_df = nlu.load('en.embed_sentence.covidbert.large_uncased').predict(text, output_level='sentence')
embeddings_df

Results

	en_embed_sentence_covidbert_large_uncased_embeddings	    sentence
	
      [-1.3138830661773682, 0.592442512512207, -0.21... 	    I hate cancer
      [0.08157740533351898, 0.2123042196035385, 0.15... 	    Antibiotics aren't painkiller

Model Information

Model Name: covidbert_large_uncased
Type: embeddings
Compatibility: Spark NLP 2.6.0+
License: Open Source
Edition: Official
Input Labels: [sentence]
Output Labels: [sentence_embeddings]
Language: [en]
Dimension: 1024
Case sensitive: false

Data Source

The model is imported from https://tfhub.dev/digitalepidemiologylab/covid-twitter-bert/2