English BertEmbeddings Cased model (from nthakur)

Description

Pretrained BertEmbeddings model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. RetroMAE_MSMARCO_finetune is a English model originally trained by nthakur.

Download Copy S3 URI

How to use

documentAssembler = DocumentAssembler() \
    .setInputCols(["text"]) \
    .setOutputCols("document")

tokenizer = Tokenizer() \
    .setInputCols("document") \
    .setOutputCol("token")

bert_loaded = BertEmbeddings.pretrained("bert_embeddings_retromae_msmarco_finetune","en") \
    .setInputCols(["document", "token"]) \
    .setOutputCol("embeddings") \
    .setCaseSensitive(True)
    
pipeline = Pipeline(stages=[documentAssembler, tokenizer, bert_loaded])

data = spark.createDataFrame([["I love Spark NLP"]]).toDF("text")

result = pipeline.fit(data).transform(data)
val documentAssembler = new DocumentAssembler() 
    .setInputCols(Array("text")) 
    .setOutputCols(Array("document"))
      
val tokenizer = new Tokenizer()
    .setInputCols("document")
    .setOutputCol("token")
 
val bert_loaded = BertEmbeddings.pretrained("bert_embeddings_retromae_msmarco_finetune","en") 
    .setInputCols(Array("document", "token"))
    .setOutputCol("embeddings")
    .setCaseSensitive(true)    
   
val pipeline = new Pipeline().setStages(Array(documentAssembler, tokenizer, bert_loaded))

val data = Seq("I love Spark NLP").toDS.toDF("text")

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

Model Information

Model Name: bert_embeddings_retromae_msmarco_finetune
Compatibility: Spark NLP 5.1.0+
License: Open Source
Edition: Official
Input Labels: [document, token]
Output Labels: [bert]
Language: en
Size: 407.7 MB
Case sensitive: true

References

  • https://huggingface.co/nthakur/RetroMAE_MSMARCO_finetune
  • https://www.SBERT.net
  • https://www.SBERT.net
  • https://www.SBERT.net
  • https://seb.sbert.net?model_name=nthakur/RetroMAE_MSMARCO_finetune
  • https://github.com/staoxiao/RetroMAE/