Swedish BERT Base Cased Embedding


The National Library of Sweden / KBLab releases three pretrained language models based on BERT and ALBERT. The models are trained on aproximately 15-20GB of text (200M sentences, 3000M tokens) from various sources (books, news, government publications, swedish wikipedia and internet forums) aiming to provide a representative BERT model for Swedish text.

Predicted Entities


How to use

embeddings = BertEmbeddings.pretrained("bert_base_cased", "sv") \
      .setInputCols("sentence", "token") \

nlp_pipeline = Pipeline(stages=[document_assembler, sentence_detector, tokenizer, embeddings])
val embeddings = BertEmbeddings.pretrained("bert_base_cased", "sv")
      .setInputCols("sentence", "token")

val pipeline = new Pipeline().setStages(Array(document_assembler, sentence_detector, tokenizer, embeddings))

Model Information

Model Name: bert_base_cased
Compatibility: Spark NLP 3.2.2+
License: Open Source
Edition: Official
Input Labels: [sentence, token]
Output Labels: [bert]
Language: sv
Case sensitive: true

Data Source

The model is imported from: https://huggingface.co/KB/bert-base-swedish-cased