French CamemBertForQuestionAnswering Base squadFR (camembert_base_qa_fquad)

Description

Pretrained CamemBertForQuestionAnswering model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. camembert_base_qa_fquad is a French model originally fine-tuned on a combo of three French Q&A datasets:

  • PIAFv1.1
  • FQuADv1.0
  • SQuAD-FR (SQuAD automatically translated to French)

Predicted Entities

Download Copy S3 URI

How to use

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

Question_Answering = CamemBertForQuestionAnswering("camembert_base_qa_fquad","fr")\
     .setInputCols(["document_question", "document_context"])\
     .setOutputCol("answer")\
     .setCaseSensitive(True)

pipeline = Pipeline(stages=[Document_Assembler, Question_Answering])

data = spark.createDataFrame([["Où est-ce que je vis?","Mon nom est Wolfgang et je vis à Berlin."]]).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 = CamemBertForQuestionAnswering("camembert_base_qa_fquad","fr")
     .setInputCols(Array("document_question", "document_context"))
     .setOutputCol("answer")
     .setCaseSensitive(True)

val pipeline = new Pipeline().setStages(Array(Document_Assembler, Question_Answering))

val data = Seq("Où est-ce que je vis?","Mon nom est Wolfgang et je vis à Berlin.").toDS.toDF("question", "context")

val result = pipeline.fit(data).transform(data)
import nlu
nlu.load("fr.answer_question.camembert.fquad").predict("""Où est-ce que je vis?|||"Mon nom est Wolfgang et je vis à Berlin.""")

Model Information

Model Name: camembert_base_qa_fquad
Compatibility: Spark NLP 4.3.0+
License: Open Source
Edition: Official
Input Labels: [document_question, document_context]
Output Labels: [answer]
Language: fr
Size: 411.9 MB

References

https://huggingface.co/etalab-ia/camembert-base-squadFR-fquad-piaf

Benchmarking

{"f1": 80.61, "exact_match": 59.54}