German Electra Embeddings (from deepset)

Description

Pretrained Electra Embeddings model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. gelectra-large-generator is a German model orginally trained by deepset.

Download Copy S3 URI

How to use

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

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

data = spark.createDataFrame([["Ich liebe Spark 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("electra_embeddings_gelectra_large_generator","de") 
    .setInputCols(Array("document", "token")) 
    .setOutputCol("embeddings")

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

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

val result = pipeline.fit(data).transform(data)
import nlu
nlu.load("de.embed.electra.large").predict("""Ich liebe Spark NLP""")

Model Information

Model Name: electra_embeddings_gelectra_large_generator
Compatibility: Spark NLP 3.4.4+
License: Open Source
Edition: Official
Input Labels: [sentence, token]
Output Labels: [embeddings]
Language: de
Size: 194.8 MB
Case sensitive: true

References

  • https://huggingface.co/deepset/gelectra-large-generator
  • 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