English RobertaForSequenceClassification Cased model (from lucianpopa)

Description

Pretrained RobertaForSequenceClassification model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. autonlp-SST1-529214890 is a English model originally trained by lucianpopa.

Predicted Entities

1, 0, 4, 3, 2

Download Copy S3 URI

How to use

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

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

roberta_classifier = RoBertaForSequenceClassification.pretrained("roberta_classifier_autonlp_sst1_529214890","en") \
    .setInputCols(["document", "token"]) \
    .setOutputCol("class")

pipeline = Pipeline(stages=[documentAssembler, tokenizer, roberta_classifier])

data = spark.createDataFrame([["I love you!"], ["I feel lucky to be here."]]).toDF("text")

result = pipeline.fit(data).transform(data)
val documentAssembler = new DocumentAssembler()
    .setInputCols("text")
    .setOutputCols("document")

val tokenizer = new Tokenizer()
    .setInputCols("document")
    .setOutputCol("token")

val roberta_classifier = RoBertaForSequenceClassification.pretrained("roberta_classifier_autonlp_sst1_529214890","en")
    .setInputCols(Array("document", "token"))
    .setOutputCol("class")

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

val data = Seq("I love you!").toDS.toDF("text")

val result = pipeline.fit(data).transform(data)
import nlu
nlu.load("en.classify.sst1.roberta.by_lucianpopa").predict("""I feel lucky to be here.""")

Model Information

Model Name: roberta_classifier_autonlp_sst1_529214890
Compatibility: Spark NLP 4.2.4+
License: Open Source
Edition: Official
Input Labels: [document, token]
Output Labels: [class]
Language: en
Size: 435.0 MB
Case sensitive: true
Max sentence length: 128

References

  • https://huggingface.co/lucianpopa/autonlp-SST1-529214890