English BertEmbeddings Base Cased model (from fnlp)

Description

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

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_claif_base","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_claif_base","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_claif_base
Compatibility: Spark NLP 5.1.0+
License: Open Source
Edition: Official
Input Labels: [document, token]
Output Labels: [bert]
Language: en
Size: 407.2 MB
Case sensitive: true

References

  • https://huggingface.co/fnlp/claif-bert-base
  • https://www.SBERT.net
  • https://www.SBERT.net
  • https://www.SBERT.net
  • https://seb.sbert.net?model_name=fnlp/claif-bert-base