BERT Embeddings (Large Uncased)


This model contains a deep bidirectional transformer trained on Wikipedia and the BookCorpus. The details are described in the paper “BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding”.


How to use

embeddings = BertEmbeddings.pretrained("bert_large_uncased", "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 love NLP"]})))
val embeddings = BertEmbeddings.pretrained("bert_large_uncased", "en")
      .setInputCols("sentence", "token")
val pipeline = new Pipeline().setStages(Array(document_assembler, sentence_detector, tokenizer, embeddings))
val result =["I love NLP"].toDS.toDF("text")).transform(data)
import nlu

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


	en_embed_bert_large_uncased_embeddings	token
	[-0.07447264343500137, -0.337308406829834, -0....	I
	[-0.5735481977462769, -0.3580206632614136, -0....	love
	[-0.3929762840270996, -0.4147087037563324, 0.2...	NLP

Model Information

Model Name: bert_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