Description
Pretrained DistilBertForMaskedLM model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. marathi-distilbert is a Marathi model originally trained by DarshanDeshpande.
How to use
documentAssembler = DocumentAssembler() \
.setInputCol("text") \
.setOutputCol("document")
tokenizer = Tokenizer() \
.setInputCols("document") \
.setOutputCol("token")
distilbert_loaded = DistilBertEmbeddings.pretrained("distilbert_embeddings_marathi","mr") \
.setInputCols(["document", "token"]) \
.setOutputCol("embeddings") \
.setCaseSensitive(False)
pipeline = Pipeline(stages=[documentAssembler, tokenizer, distilbert_loaded])
data = spark.createDataFrame([["I love Spark NLP"]]).toDF("text")
result = pipeline.fit(data).transform(data)
val documentAssembler = new DocumentAssembler()
.setInputCol("text")
.setOutputCol("document")
val tokenizer = new Tokenizer()
.setInputCols("document")
.setOutputCol("token")
val distilbert_loaded = DistilBertEmbeddings.pretrained("distilbert_embeddings_marathi","mr")
.setInputCols(Array("document", "token"))
.setOutputCol("embeddings")
.setCaseSensitive(false)
val pipeline = new Pipeline().setStages(Array(documentAssembler, tokenizer, distilbert_loaded))
val data = Seq("I love Spark NLP").toDS.toDF("text")
val result = pipeline.fit(data).transform(data)
import nlu
nlu.load("mr.embed.distil_bert").predict("""I love Spark NLP""")
Model Information
| Model Name: | distilbert_embeddings_marathi |
| Compatibility: | Spark NLP 4.2.4+ |
| License: | Open Source |
| Edition: | Official |
| Input Labels: | [sentence, token] |
| Output Labels: | [embeddings] |
| Language: | mr |
| Size: | 247.8 MB |
| Case sensitive: | false |
References
- https://huggingface.co/DarshanDeshpande/marathi-distilbert
- https://github.com/DarshanDeshpande
- https://www.linkedin.com/in/darshan-deshpande/
- https://github.com/Baras64
- http://www.linkedin.com/in/harsh-abhi