English RobertaForQuestionAnswering Base Cased model (from csarron)

Description

Pretrained RobertaForQuestionAnswering model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. roberta-base-squad-v1 is a English model originally trained by csarron.

Download Copy S3 URI

How to use

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

Question_Answering = RoBertaForQuestionAnswering.pretrained("roberta_qa_base_squad_v1","en")\
     .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_base_squad_v1","en")
     .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("en.answer_question.roberta.squad.base.by_csarron").predict("""What's my name?|||"My name is Clara and I live in Berkeley.""")

Model Information

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

References

  • https://huggingface.co/csarron/roberta-base-squad-v1
  • https://arxiv.org/abs/1907.11692
  • https://rajpurkar.github.io/SQuAD-explorer
  • https://rajpurkar.github.io/SQuAD-explorer/dataset/train-v1.1.json
  • https://rajpurkar.github.io/SQuAD-explorer/dataset/dev-v1.1.json
  • https://awk.ai/
  • https://github.com/csarron
  • https://twitter.com/sysnlp