German Bert Embeddings (from deepset)

Description

Pretrained Bert Embeddings model, uploaded to Hugging Face, adapted and imported into Spark NLP. gbert-base is a German model orginally trained by deepset.

Download

How to use

documentAssembler = DocumentAssembler() \
    .setInputCol("text") \
    .setOutputCol("document")

tokenizer = Tokenizer() \
    .setInputCols("document") \
    .setOutputCol("token")
  
embeddings = BertEmbeddings.pretrained("bert_embeddings_gbert_base","de") \
    .setInputCols(["document", "token"]) \
    .setOutputCol("embeddings")
    
pipeline = Pipeline(stages=[documentAssembler, tokenizer, embeddings])

data = spark.createDataFrame([["Ich liebe Funken NLP"]]).toDF("text")

result = pipeline.fit(data).transform(data)
val documentAssembler = new DocumentAssembler() 
      .setInputCol("text") 
      .setOutputCol("document")
 
val tokenizer = new Tokenizer() 
    .setInputCols(Array("document"))
    .setOutputCol("token")

val embeddings = BertEmbeddings.pretrained("bert_embeddings_gbert_base","de") 
    .setInputCols(Array("document", "token")) 
    .setOutputCol("embeddings")

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

val data = Seq("Ich liebe Funken NLP").toDF("text")

val result = pipeline.fit(data).transform(data)

Model Information

Model Name: bert_embeddings_gbert_base
Compatibility: Spark NLP 3.4.2+
License: Open Source
Edition: Official
Input Labels: [sentence, token]
Output Labels: [bert]
Language: de
Size: 412.6 MB
Case sensitive: true

References

  • https://huggingface.co/deepset/gbert-base
  • https://arxiv.org/pdf/2010.10906.pdf
  • https://arxiv.org/pdf/2010.10906.pdf
  • https://deepset.ai/german-bert
  • https://deepset.ai/germanquad
  • https://github.com/deepset-ai/FARM
  • https://github.com/deepset-ai/haystack/
  • https://twitter.com/deepset_ai
  • https://www.linkedin.com/company/deepset-ai/
  • https://haystack.deepset.ai/community/join
  • https://github.com/deepset-ai/haystack/discussions
  • https://deepset.ai
  • http://www.deepset.ai/jobs