English RobertaForQuestionAnswering Large Cased model (from akdeniz27)

Description

Pretrained RobertaForQuestionAnswering model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. roberta-large-cuad is a English model originally trained by akdeniz27.

Download Copy S3 URI

How to use

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

Question_Answering = RoBertaForQuestionAnswering.pretrained("roberta_qa_large_cuad","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_large_cuad","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.cuad.large").predict("""What's my name?|||"My name is Clara and I live in Berkeley.""")

Model Information

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

References

  • https://huggingface.co/akdeniz27/roberta-large-cuad
  • https://www.atticusprojectai.org/cuad
  • https://github.com/TheAtticusProject/cuad
  • https://arxiv.org/abs/2103.06268
  • https://aclanthology.org/2021.acl-long.330.pdf
  • https://dl.acm.org/doi/pdf/10.1145/3442188.3445922
  • https://drive.google.com/file/d/1of37X0hAhECQ3BN_004D8gm6V88tgZaB/view?usp=sharing
  • https://zenodo.org/record/4599830
  • https://mlco2.github.io/impact#compute
  • https://arxiv.org/abs/1910.09700
  • https://www.atticusprojectai.org/cuad
  • https://www.atticusprojectai.org/