Description
Pretrained RobertaForSequenceClassification model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. roberta-large-mnli
is a English model originally trained by HuggingFace.
Predicted Entities
ENTAILMENT
, NEUTRAL
, CONTRADICTION
How to use
documentAssembler = DocumentAssembler() \
.setInputCol("text") \
.setOutputCol("document")
tokenizer = Tokenizer() \
.setInputCols("document") \
.setOutputCol("token")
seq_classifier = RoBertaForSequenceClassification.pretrained("roberta_classifier_large_mnli","en") \
.setInputCols(["document", "token"]) \
.setOutputCol("class")
pipeline = Pipeline(stages=[documentAssembler, tokenizer, seq_classifier])
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 seq_classifier = RoBertaForSequenceClassification.pretrained("roberta_classifier_large_mnli","en")
.setInputCols(Array("document", "token"))
.setOutputCol("class")
val pipeline = new Pipeline().setStages(Array(documentAssembler, tokenizer, seq_classifier))
val data = Seq("PUT YOUR STRING HERE").toDS.toDF("text")
val result = pipeline.fit(data).transform(data)
import nlu
nlu.load("en.classify.roberta.large.by_uploaded by huggingface").predict("""PUT YOUR STRING HERE""")
Model Information
Model Name: | roberta_classifier_large_mnli |
Compatibility: | Spark NLP 5.2.0+ |
License: | Open Source |
Edition: | Official |
Input Labels: | [document, token] |
Output Labels: | [class] |
Language: | en |
Size: | 845.5 MB |
Case sensitive: | true |
Max sentence length: | 256 |
References
References
- https://huggingface.co/roberta-large-mnli
- https://github.com/facebookresearch/fairseq/tree/main/examples/roberta
- https://arxiv.org/abs/1907.11692
- https://github.com/facebookresearch/fairseq/tree/main/examples/roberta
- https://github.com/facebookresearch/fairseq/tree/main/examples/roberta
- https://aclanthology.org/2021.acl-long.330.pdf
- https://dl.acm.org/doi/pdf/10.1145/3442188.3445922
- https://cims.nyu.edu/~sbowman/multinli/
- https://yknzhu.wixsite.com/mbweb
- https://en.wikipedia.org/wiki/English_Wikipedia
- https://commoncrawl.org/2016/10/news-dataset-available/
- https://github.com/jcpeterson/openwebtext
- https://arxiv.org/abs/1806.02847
- https://github.com/facebookresearch/fairseq/tree/main/examples/roberta
- https://arxiv.org/pdf/1804.07461.pdf
- https://cims.nyu.edu/~sbowman/multinli/
- https://arxiv.org/pdf/1804.07461.pdf
- https://arxiv.org/pdf/1804.07461.pdf
- https://arxiv.org/abs/1704.05426
- https://arxiv.org/abs/1508.05326
- https://arxiv.org/pdf/1809.05053.pdf
- https://cims.nyu.edu/~sbowman/multinli/
- https://arxiv.org/pdf/1809.05053.pdf
- https://mlco2.github.io/impact#compute
- https://arxiv.org/abs/1910.09700
- https://arxiv.org/pdf/1907.11692.pdf
- https://arxiv.org/pdf/1907.11692.pdf