English custom_legalbert BertEmbeddings from casehold

Description

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

Download Copy S3 URI

How to use



document_assembler = DocumentAssembler() \
    .setInputCol("text") \
    .setOutputCol("documents")
    
    
embeddings =BertEmbeddings.pretrained("custom_legalbert","en") \
            .setInputCols(["documents","token"]) \
            .setOutputCol("embeddings")

pipeline = Pipeline().setStages([document_assembler, embeddings])

pipelineModel = pipeline.fit(data)

pipelineDF = pipelineModel.transform(data)



val document_assembler = new DocumentAssembler()
    .setInputCol("text") 
    .setOutputCol("embeddings")
    
val embeddings = BertEmbeddings 
    .pretrained("custom_legalbert", "en")
    .setInputCols(Array("documents","token")) 
    .setOutputCol("embeddings") 

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

val pipelineModel = pipeline.fit(data)

val pipelineDF = pipelineModel.transform(data)


Model Information

Model Name: custom_legalbert
Compatibility: Spark NLP 5.1.1+
License: Open Source
Edition: Official
Input Labels: [documents, token]
Output Labels: [embeddings]
Language: en
Size: 411.6 MB

References

https://huggingface.co/casehold/custom-legalbert