Multilingual BERT Embeddings (Base Cased)


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

text = ["I love Spark NLP"]
embeddings_df = nlu.load('xx.embed.bert_multi_cased').predict(text, output_level='token')


	xx_embed_bert_multi_cased_embeddings	            token
      [0.31631314754486084, -0.5579454898834229, 0.1... 	I
 	[-0.1488783359527588, -0.27264419198036194, -0... 	love
 	[0.0496230386197567, -0.43625175952911377, -0.... 	Spark
 	[-0.2838578224182129, -0.7103433012962341, 0.4... 	NLP

Model Information

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

Data Source

The model is imported from