Korean ElectraForQuestionAnswering Small model (from monologg) Version-3

Description

Pretrained Question Answering model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. koelectra-small-v3-finetuned-korquad is a Korean model originally trained by monologg.

Download Copy S3 URI

How to use

documentAssembler = MultiDocumentAssembler() \
.setInputCols(["question", "context"]) \
.setOutputCols(["document_question", "document_context"])

spanClassifier = BertForQuestionAnswering.pretrained("electra_qa_small_v3_finetuned_korquad","ko") \
.setInputCols(["document_question", "document_context"]) \
.setOutputCol("answer")\
.setCaseSensitive(True)

pipeline = Pipeline(stages=[documentAssembler, spanClassifier])

data = spark.createDataFrame([["내 이름은 무엇입니까?", "제 이름은 클라라이고 저는 버클리에 살고 있습니다."]]).toDF("question", "context")

result = pipeline.fit(data).transform(data)
val documentAssembler = new MultiDocumentAssembler() 
.setInputCols(Array("question", "context")) 
.setOutputCols(Array("document_question", "document_context"))

val spanClassifer = BertForQuestionAnswering.pretrained("electra_qa_small_v3_finetuned_korquad","ko") 
.setInputCols(Array("document", "token")) 
.setOutputCol("answer")
.setCaseSensitive(true)

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

val data = Seq("내 이름은 무엇입니까?", "제 이름은 클라라이고 저는 버클리에 살고 있습니다.").toDF("question", "context")

val result = pipeline.fit(data).transform(data)
import nlu
nlu.load("ko.answer_question.korquad.electra.small").predict("""내 이름은 무엇입니까?|||"제 이름은 클라라이고 저는 버클리에 살고 있습니다.""")

Model Information

Model Name: electra_qa_small_v3_finetuned_korquad
Compatibility: Spark NLP 4.0.0+
License: Open Source
Edition: Official
Input Labels: [document_question, document_context]
Output Labels: [answer]
Language: ko
Size: 53.7 MB
Case sensitive: true
Max sentence length: 512

References

  • https://huggingface.co/monologg/koelectra-small-v3-finetuned-korquad