Edit model card

QAmembert

Model Description

We present QAmemBERT, which is a CamemBERT base fine-tuned for the Question-Answering task for the French language on four French Q&A datasets composed of contexts and questions with their answers inside the context (= SQuAD v1 format) but also contexts and questions with their answers not inside the context (= SQuAD v2 format). All these datasets were concatenated into a single dataset that we called frenchQA. This represents a total of over 221,348 questions/answers pairs used to finetune this model and 6,376 to test it.

Datasets

Dataset Format Train split Dev split Test split
piaf SQuAD v1 9 224 Q & A X X
piaf_v2 SQuAD v2 9 224 Q & A X X
fquad SQuAD v1 20 731 Q & A 3 188 Q & A (not used in training because it serves as a test dataset) 2 189 Q & A (not used in our work because not freely available)
fquad_v2 SQuAD v2 20 731 Q & A 3 188 Q & A (not used in training because it serves as a test dataset) X
lincoln/newsquadfr SQuAD v1 1 650 Q & A 455 Q & A (not used in our work) X
lincoln/newsquadfr_v2 SQuAD v2 1 650 Q & A 455 Q & A (not used in our work) X
pragnakalp/squad_v2_french_translated SQuAD v2 79 069 Q & A X X
pragnakalp/squad_v2_french_translated_v2 SQuAD v2 79 069 Q & A X X

All these datasets were concatenated into a single dataset that we called frenchQA.

Evaluation results

The evaluation was carried out using the evaluate python package.

FQuaD 1.0 (validation)

The metric used is Squad v1.

Model Exact_match F1-score
etalab-ia/camembert-base-squadFR-fquad-piaf 53.60 78.09
QAmembert (previous version) 54.26 77.87
QAmembert (this version) 53.98 78.00
QAmembert-large ♪ 55.95 81.05
fT0 41.15 65.79

♪ this model is available on request only

qwant/squad_fr (validation)

The metric used is Squad v1.

Model Exact_match F1-score
etalab-ia/camembert-base-squadFR-fquad-piaf 60.17 78.27
QAmembert (previous version) 60.40 77.27
QAmembert (this version) 60.95 77.30
QAmembert-large ♪ 65.58 81.74
fT0 41.05 56.14

♪ this model is available on request only.

frenchQA

This dataset includes question with no answers in the context. The metric used is Squad v2.

Model Exact_match F1-score Answer_f1 NoAnswer_f1
etalab-ia/camembert-base-squadFR-fquad-piaf n/a n/a n/a n/a
QAmembert (previous version) 60.28 71.29 75.92 66.65
QAmembert (this version) 77.14 86.88 75.66 98.11
QAmembert-large ♪ 77.14 88.74 78.83 98.65

♪ this model is available on request only.

Usage

Example with answer in the context

from transformers import pipeline

qa = pipeline('question-answering', model='CATIE-AQ/QAmembert', tokenizer='CATIE-AQ/QAmembert')

result = qa({
    'question': "Combien de personnes utilisent le français tous les jours ?",
    'context': "Le français est une langue indo-européenne de la famille des langues romanes dont les locuteurs sont appelés francophones. Elle est parfois surnommée la langue de Molière.  Le français est parlé, en 2023, sur tous les continents par environ 321 millions de personnes : 235 millions l'emploient quotidiennement et 90 millions en sont des locuteurs natifs. En 2018, 80 millions d'élèves et étudiants s'instruisent en français dans le monde. Selon l'Organisation internationale de la francophonie (OIF), il pourrait y avoir 700 millions de francophones sur Terre en 2050."
})

if result['score'] < 0.01:
    print("La réponse n'est pas dans le contexte fourni.")
else :
    print(result['answer'])
235 millions
# details
result
{'score': 0.9945194721221924,
 'start': 269,
 'end': 281,
 'answer': '235 millions'}

Example with answer not in the context

from transformers import pipeline

qa = pipeline('question-answering', model='CATIE-AQ/QAmembert', tokenizer='CATIE-AQ/QAmembert')

result = qa({
    'question': "Quel est le meilleur vin du monde ?",
    'context': "La tour Eiffel est une tour de fer puddlé de 330 m de hauteur (avec antennes) située à Paris, à l’extrémité nord-ouest du parc du Champ-de-Mars en bordure de la Seine dans le 7e arrondissement. Son adresse officielle est 5, avenue Anatole-France.  
Construite en deux ans par Gustave Eiffel et ses collaborateurs pour l'Exposition universelle de Paris de 1889, célébrant le centenaire de la Révolution française, et initialement nommée « tour de 300 mètres », elle est devenue le symbole de la capitale française et un site touristique de premier plan : il s’agit du quatrième site culturel français payant le plus visité en 2016, avec 5,9 millions de visiteurs. Depuis son ouverture au public, elle a accueilli plus de 300 millions de visiteurs."
})

if result['score'] < 0.01:
    print("La réponse n'est pas dans le contexte fourni.")
else :
    print(result['answer'])
La réponse n'est pas dans le contexte fourni.
# details
result
{'score': 3.619904940035945e-13,
 'start': 734,
 'end': 744,
 'answer': 'visiteurs.'}

Try it through Space

A Space has been created to test the model. It is available here.

Environmental Impact

Carbon emissions were estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019). The hardware, runtime, cloud provider, and compute region were utilized to estimate the carbon impact.

  • Hardware Type: A100 PCIe 40/80GB
  • Hours used: 5h and 36 min
  • Cloud Provider: Private Infrastructure
  • Carbon Efficiency (kg/kWh): 0.076kg (estimated from electricitymaps ; we take the average carbon intensity in France for the month of March 2023, as we are unable to use the data for the day of training, which are not available.)
  • Carbon Emitted (Power consumption x Time x Carbon produced based on location of power grid): 0.1 kg eq. CO2

Citations

QAmemBERT

@misc {centre_aquitain_des_technologies_de_l'information_et_electroniques_2023,
    author       = { {Centre Aquitain des Technologies de l'Information et Electroniques} },
    title        = { QAmembert (Revision 9685bc3) },
    year         = 2023,
    url          = { https://huggingface.co/CATIE-AQ/QAmembert },
    doi          = { 10.57967/hf/0821 },
    publisher    = { Model Database }
}

PIAF

@inproceedings{KeraronLBAMSSS20,
  author    = {Rachel Keraron and
               Guillaume Lancrenon and
               Mathilde Bras and
               Fr{\'{e}}d{\'{e}}ric Allary and
               Gilles Moyse and
               Thomas Scialom and
               Edmundo{-}Pavel Soriano{-}Morales and
               Jacopo Staiano},
  title     = {Project {PIAF:} Building a Native French Question-Answering Dataset},
  booktitle = {{LREC}},
  pages     = {5481--5490},
  publisher = {European Language Resources Association},
  year      = {2020}
}

FQuAD

@article{dHoffschmidt2020FQuADFQ,
  title={FQuAD: French Question Answering Dataset},
  author={Martin d'Hoffschmidt and Maxime Vidal and Wacim Belblidia and Tom Brendl'e and Quentin Heinrich},
  journal={ArXiv},
  year={2020},
  volume={abs/2002.06071}
}

lincoln/newsquadfr

Model Database repository : https://huggingface.co/datasets/lincoln/newsquadfr

pragnakalp/squad_v2_french_translated

Model Database repository : https://huggingface.co/datasets/pragnakalp/squad_v2_french_translated

CamemBERT

@inproceedings{martin2020camembert,
  title={CamemBERT: a Tasty French Language Model},
  author={Martin, Louis and Muller, Benjamin and Su{\'a}rez, Pedro Javier Ortiz and Dupont, Yoann and Romary, Laurent and de la Clergerie, {\'E}ric Villemonte and Seddah, Djam{\'e} and Sagot, Beno{\^\i}t},
  booktitle={Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics},
  year={2020}
}

License

cc-by-4.0

Downloads last month
5,762
Safetensors
Model size
110M params
Tensor type
I64
·
F32
·
Hosted inference API
This model can be loaded on the Inference API on-demand.

Datasets used to train CATIE-AQ/QAmembert

Space using CATIE-AQ/QAmembert 1