Multilingual XLMRobertaForTokenClassification Large Cased model

Description

Pretrained XLMRobertaForTokenClassification model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. xlm-roberta-large-finetuned-conll03-english is a Multilingual model originally trained by HuggingFace.

Predicted Entities

ORG, LOC, PER, MISC

Download Copy S3 URI

How to use

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

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

token_classifier = XlmRoBertaForTokenClassification.pretrained("xlmroberta_ner_large_finetuned_conll03_english","xx") \
    .setInputCols(["document", "token"]) \
    .setOutputCol("ner")

ner_converter = NerConverter()\
    .setInputCols(["document", "token", "ner"])\
    .setOutputCol("ner_chunk")

pipeline = Pipeline(stages=[documentAssembler, tokenizer, token_classifier, ner_converter])

data = spark.createDataFrame([["PUT YOUR STRING HERE"]]).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 token_classifier = XlmRoBertaForTokenClassification.pretrained("xlmroberta_ner_large_finetuned_conll03_english","xx")
    .setInputCols(Array("document", "token"))
    .setOutputCol("ner")

val ner_converter = new NerConverter()
    .setInputCols(Array("document", "token', "ner"))
    .setOutputCol("ner_chunk")

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

val data = Seq("PUT YOUR STRING HERE").toDS.toDF("text")

val result = pipeline.fit(data).transform(data)
import nlu
nlu.load("xx.ner.xlmr_roberta.conll.large_finetuned").predict("""PUT YOUR STRING HERE""")

Model Information

Model Name: xlmroberta_ner_large_finetuned_conll03_english
Compatibility: Spark NLP 4.1.0+
License: Open Source
Edition: Official
Input Labels: [document, token]
Output Labels: [ner]
Language: xx
Size: 1.8 GB
Case sensitive: true
Max sentence length: 256

References

  • https://huggingface.co/xlm-roberta-large-finetuned-conll03-english
  • https://arxiv.org/abs/1911.02116
  • https://arxiv.org/abs/1911.02116
  • https://github.com/facebookresearch/fairseq/tree/main/examples/xlmr
  • https://github.com/facebookresearch/fairseq/tree/main/examples/xlmr
  • https://arxiv.org/abs/1911.02116
  • https://aclanthology.org/2021.acl-long.330.pdf
  • https://dl.acm.org/doi/pdf/10.1145/3442188.3445922
  • https://arxiv.org/pdf/2008.03415.pdf
  • https://arxiv.org/pdf/2008.03415.pdf
  • https://arxiv.org/pdf/1911.02116.pdf
  • https://arxiv.org/pdf/1911.02116.pdf
  • https://mlco2.github.io/impact#compute
  • https://arxiv.org/abs/1910.09700
  • https://arxiv.org/pdf/1911.02116.pdf
  • https://arxiv.org/pdf/1911.02116.pdf