DeBerta Zero-Shot Classification Base - MNLI ANLI (deberta_base_zero_shot_classifier_mnli_anli_v3

Description

“ Pretrained DeBertaForZeroShotClassification model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP.deberta_base_zero_shot_classifier_mnli_anli_v3 is a English model originally trained by MoritzLaurer.

Download Copy S3 URI

How to use


document_assembler = DocumentAssembler() \
.setInputCol('text') \
.setOutputCol('document')

tokenizer = Tokenizer() \
.setInputCols(['document']) \
.setOutputCol('token')

zeroShotClassifier = DeBertaForZeroShotClassification \
.pretrained('deberta_base_zero_shot_classifier_mnli_anli_v3', 'en') \
.setInputCols(['token', 'document']) .setOutputCol('class') \
.setCaseSensitive(True) \
.setMaxSentenceLength(512) \
.setCandidateLabels(["urgent", "mobile", "travel", "movie", "music", "sport", "weather", "technology"])

pipeline = Pipeline(stages=[
document_assembler,
tokenizer,
zeroShotClassifier
])

example = spark.createDataFrame([['I have a problem with my iphone that needs to be resolved asap!!']]).toDF("text")
result = pipeline.fit(example).transform(example)


val document_assembler = DocumentAssembler()
.setInputCol("text")
.setOutputCol("document")

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

val zeroShotClassifier = DeBertaForZeroShotClassification.pretrained("deberta_base_zero_shot_classifier_mnli_anli_v3", "en")
.setInputCols("document", "token")
.setOutputCol("class")
.setCaseSensitive(true)
.setMaxSentenceLength(512)
.setCandidateLabels(Array("urgent", "mobile", "travel", "movie", "music", "sport", "weather", "technology"))

val pipeline = new Pipeline().setStages(Array(document_assembler, tokenizer, zeroShotClassifier))

val example = Seq("I have a problem with my iphone that needs to be resolved asap!!").toDS.toDF("text")

val result = pipeline.fit(example).transform(example)


Model Information

Model Name: deberta_base_zero_shot_classifier_mnli_anli_v3
Compatibility: Spark NLP 5.4.2+
License: Open Source
Edition: Official
Input Labels: [token, document]
Output Labels: [label]
Language: en
Size: 439.2 MB
Case sensitive: true