Description
Pretrained BertForQuestionAnswering model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. BERT-L-QA is a English model originally trained by Shobhank-iiitdwd.
How to use
Document_Assembler = MultiDocumentAssembler()\
.setInputCols(["question", "context"])\
.setOutputCols(["document_question", "document_context"])
Question_Answering = BertForQuestionAnswering.pretrained("Bert_qa_l","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 = BertForQuestionAnswering.pretrained("Bert_qa_l","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)
Model Information
| Model Name: | Bert_qa_l |
| Compatibility: | Spark NLP 4.4.0+ |
| License: | Open Source |
| Edition: | Official |
| Input Labels: | [document_question, document_context] |
| Output Labels: | [answer] |
| Language: | en |
| Size: | 1.3 GB |
| Case sensitive: | true |
| Max sentence length: | 512 |
References
- https://huggingface.co/Shobhank-iiitdwd/BERT-L-QA
- https://haystack.deepset.ai/tutorials/first-qa-system
- https://github.com/deepset-ai/haystack/
- http://deepset.ai/
- https://haystack.deepset.ai/
- https://deepset.ai/german-bert
- https://deepset.ai/germanquad
- https://github.com/deepset-ai/haystack
- https://docs.haystack.deepset.ai
- https://haystack.deepset.ai/community
- https://twitter.com/deepset_ai
- https://www.linkedin.com/company/deepset-ai/
- https://haystack.deepset.ai/community/join
- https://github.com/deepset-ai/haystack/discussions
- https://deepset.ai
- http://www.deepset.ai/jobs
- https://paperswithcode.com/sota?task=Question+Answering&dataset=squad_v2