Description
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”.
Predicted Entities
How to use
...
embeddings = BertEmbeddings.pretrained("bert_base_cased", "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("bert_base_cased", "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.bert.base_cased').predict(text, output_level='token')
embeddings_df
Results
Results
token en_embed_bert_base_cased_embeddings
I [0.43879568576812744, -0.40160006284713745, 0....
love [0.21737590432167053, -0.3865768313407898, -0....
NLP [-0.16226479411125183, -0.053727392107248306, ...
{:.model-param}
Model Information
Model Name: | bert_base_cased |
Compatibility: | Spark NLP 5.0.0+ |
License: | Open Source |
Edition: | Official |
Input Labels: | [sentence, token] |
Output Labels: | [bert] |
Language: | en |
Size: | 403.6 MB |
Case sensitive: | true |
References
The model is imported from https://tfhub.dev/google/bert_cased_L-12_H-768_A-12/1