Description
Pretrained Question Answering model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. distilbert-base-uncased-finetuned-squad
is a English model originally trained by HomayounSadri
.
How to use
documentAssembler = MultiDocumentAssembler() \
.setInputCols(["question", "context"]) \
.setOutputCols(["document_question", "document_context"])
spanClassifier = DistilBertForQuestionAnswering.pretrained("distilbert_qa_HomayounSadri_base_uncased_finetuned_squad","en") \
.setInputCols(["document_question", "document_context"]) \
.setOutputCol("answer")\
.setCaseSensitive(True)
pipeline = Pipeline(stages=[documentAssembler, spanClassifier])
data = spark.createDataFrame([["What is my name?", "My name is Clara and I live in Berkeley."]]).toDF("question", "context")
result = pipeline.fit(data).transform(data)
Model Information
Model Name: | distilbert_qa_HomayounSadri_base_uncased_finetuned_squad |
Compatibility: | Spark NLP 4.0.0+ |
License: | Open Source |
Edition: | Official |
Input Labels: | [document_question, document_context] |
Output Labels: | [answer] |
Language: | en |
Size: | 247.5 MB |
Case sensitive: | false |
Max sentence length: | 512 |
References
- https://huggingface.co/HomayounSadri/distilbert-base-uncased-finetuned-squad