COVID BERT Embeddings (Large Uncased)

Description

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

Download Copy S3 URI

How to use

...
embeddings = BertEmbeddings.pretrained("covidbert_large_uncased", "en") \
.setInputCols("sentence", "token") \
.setOutputCol("embeddings")
nlp_pipeline = Pipeline(stages=[document_assembler, sentence_detector, tokenizer, embeddings])
pipeline_model = nlp_pipeline.fit(spark.createDataFrame([[""]]).toDF("text"))
result = pipeline_model.transform(spark.createDataFrame([['I love NLP']], ["text"]))
...
val embeddings = BertEmbeddings.pretrained("covidbert_large_uncased", "en")
.setInputCols("sentence", "token")
.setOutputCol("embeddings")
val pipeline = new Pipeline().setStages(Array(document_assembler, sentence_detector, tokenizer, embeddings))
val data = Seq("I love NLP").toDF("text")
val result = pipeline.fit(data).transform(data)
import nlu

text = ["I love NLP"]
embeddings_df = nlu.load('en.embed.covidbert.large_uncased').predict(text, output_level='token')
embeddings_df

Results

	en_embed_covidbert_large_uncased_embeddings	      token
	
[-1.934066891670227, 0.620597779750824, 0.0967... 	I
[-0.5530431866645813, 1.1948248147964478, -0.0... 	love
[0.255395770072937, 0.5808677077293396, 0.3073... 	NLP

Model Information

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

Data Source

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