Bulgarian RobertaForMaskedLM Small Cased model (from iarfmoose)

Description

Pretrained RobertaForMaskedLM model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. roberta-small-bulgarian is a Bulgarian model originally trained by iarfmoose.

Download Copy S3 URI

How to use

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

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

roberta_loaded = RoBertaEmbeddings.pretrained("roberta_embeddings_small_bulgarian","bg") \
    .setInputCols(["document", "token"]) \
    .setOutputCol("embeddings") \
    .setCaseSensitive(True)

pipeline = Pipeline(stages=[documentAssembler, tokenizer, roberta_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 roberta_loaded = RoBertaEmbeddings.pretrained("roberta_embeddings_small_bulgarian","bg")
    .setInputCols(Array("document", "token"))
    .setOutputCol("embeddings")
    .setCaseSensitive(true)

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

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

val result = pipeline.fit(data).transform(data)
import nlu
nlu.load("bg.embed.roberta.small").predict("""I love Spark NLP""")

Model Information

Model Name: roberta_embeddings_small_bulgarian
Compatibility: Spark NLP 4.2.4+
License: Open Source
Edition: Official
Input Labels: [sentence, token]
Output Labels: [embeddings]
Language: bg
Size: 314.4 MB
Case sensitive: true

References

  • https://huggingface.co/iarfmoose/roberta-small-bulgarian
  • https://arxiv.org/abs/1907.11692
  • https://oscar-corpus.com/
  • https://wortschatz.uni-leipzig.de/en/download/bulgarian
  • https://wortschatz.uni-leipzig.de/en/download/bulgarian