Description
Pretrained RobertaForQuestionAnswering model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. roberta-large-bne-sqac
is a Spanish model originally trained by PlanTL-GOB-ES
.
How to use
Document_Assembler = MultiDocumentAssembler()\
.setInputCols(["question", "context"])\
.setOutputCols(["document_question", "document_context"])
Question_Answering = RoBertaForQuestionAnswering.pretrained("roberta_qa_plantl_gob_es_large_bne_s_c","es")\
.setInputCols(["document_question", "document_context"])\
.setOutputCol("answer")\
.setCaseSensitive(True)
pipeline = Pipeline(stages=[Document_Assembler, Question_Answering])
data = spark.createDataFrame([["What's my name?","My name is Clara and I live in Berkeley."]]).toDF("question", "context")
result = pipeline.fit(data).transform(data)
val Document_Assembler = new MultiDocumentAssembler()
.setInputCols(Array("question", "context"))
.setOutputCols(Array("document_question", "document_context"))
val Question_Answering = RoBertaForQuestionAnswering.pretrained("roberta_qa_plantl_gob_es_large_bne_s_c","es")
.setInputCols(Array("document_question", "document_context"))
.setOutputCol("answer")
.setCaseSensitive(True)
val pipeline = new Pipeline().setStages(Array(Document_Assembler, Question_Answering))
val data = Seq("What's my name?","My name is Clara and I live in Berkeley.").toDS.toDF("question", "context")
val result = pipeline.fit(data).transform(data)
import nlu
nlu.load("es.answer_question.roberta.sqac.large.by_plantl_gob_es").predict("""What's my name?|||"My name is Clara and I live in Berkeley.""")
Model Information
Model Name: | roberta_qa_plantl_gob_es_large_bne_s_c |
Compatibility: | Spark NLP 4.2.4+ |
License: | Open Source |
Edition: | Official |
Input Labels: | [document, token] |
Output Labels: | [class] |
Language: | es |
Size: | 1.3 GB |
Case sensitive: | true |
Max sentence length: | 256 |
References
- https://huggingface.co/PlanTL-GOB-ES/roberta-large-bne-sqac
- https://arxiv.org/abs/1907.11692
- http://www.bne.es/en/Inicio/index.html
- https://github.com/PlanTL-GOB-ES/lm-spanish
- https://www.apache.org/licenses/LICENSE-2.0
- http://journal.sepln.org/sepln/ojs/ojs/index.php/pln/article/view/6405
- https://paperswithcode.com/sota?task=question-answering&dataset=SQAC