bourdoiscatie commited on
Commit
1745070
·
1 Parent(s): 9017993

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +220 -0
README.md CHANGED
@@ -1,3 +1,223 @@
1
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: cc-by-4.0
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language: fr
3
+ datasets:
4
+ - etalab-ia/piaf
5
+ - fquad
6
+ - lincoln/newsquadfr
7
+ - pragnakalp/squad_v2_french_translated
8
+ widget:
9
+ - text: Combien de personnes utilisent le français tous les jours ?
10
+ context: >-
11
+ Le français est une langue indo-européenne de la famille des langues romanes
12
+ dont les locuteurs sont appelés francophones. Elle est parfois surnommée la
13
+ langue de Molière. Le français est parlé, en 2023, sur tous les continents
14
+ par environ 321 millions de personnes : 235 millions l'emploient
15
+ quotidiennement et 90 millions en sont des locuteurs natifs. En 2018, 80
16
+ millions d'élèves et étudiants s'instruisent en français dans le monde.
17
+ Selon l'Organisation internationale de la francophonie (OIF), il pourrait y
18
+ avoir 700 millions de francophones sur Terre en 2050.
19
  license: cc-by-4.0
20
+ metrics:
21
+ - f1
22
+ - exact_match
23
+ library_name: transformers
24
+ pipeline_tag: question-answering
25
+ co2_eq_emissions: 200
26
  ---
27
+
28
+ # QAmembert
29
+
30
+ ## Model Description
31
+
32
+ We present **QAmemBERT**, which is a [CamemBERT base](https://huggingface.co/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).
33
+ All these datasets were concatenated into a single dataset that we called [frenchQA](https://huggingface.co/datasets/CATIE-AQ/frenchQA).
34
+ This represents a total of over **221,348 questions/answers pairs used to finetune this model and 6,376 to test it**.
35
+
36
+
37
+ ## Datasets
38
+
39
+ | Dataset | Format | Train split | Dev split | Test split |
40
+ | ----------- | ----------- | ----------- | ----------- | ----------- |
41
+ | [piaf](https://www.data.gouv.fr/en/datasets/piaf-le-dataset-francophone-de-questions-reponses/)| SQuAD v1 | 9 224 Q & A | X | X |
42
+ | piaf_v2| SQuAD v2 | 9 224 Q & A | X | X |
43
+ | [fquad](https://fquad.illuin.tech/)| 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)|
44
+ | fquad_v2 | SQuAD v2 | 20 731 Q & A | 3 188 Q & A (not used in training because it serves as a test dataset) | X |
45
+ | [lincoln/newsquadfr](https://huggingface.co/datasets/lincoln/newsquadfr) | SQuAD v1 | 1 650 Q & A | 455 Q & A (not used in our work) | X |
46
+ | lincoln/newsquadfr_v2 | SQuAD v2 | 1 650 Q & A | 455 Q & A (not used in our work) | X |
47
+ | [pragnakalp/squad_v2_french_translated](https://huggingface.co/datasets/pragnakalp/squad_v2_french_translated)| SQuAD v2 | 79 069 Q & A | X | X |
48
+ | pragnakalp/squad_v2_french_translated_v2| SQuAD v2 | 79 069 Q & A | X | X |
49
+
50
+ All these datasets were concatenated into a single dataset that we called [frenchQA](https://huggingface.co/datasets/CATIE-AQ/frenchQA).
51
+
52
+
53
+ ## Evaluation results
54
+
55
+ The evaluation was carried out using the [**evaluate**](https://pypi.org/project/evaluate/) python package.
56
+
57
+ ### FQuaD 1.0 (validation)
58
+
59
+ The metric used is Squad v1.
60
+
61
+ | Model | Exact_match | F1-score |
62
+ | ----------- | ----------- | ----------- |
63
+ | [etalab-ia/camembert-base-squadFR-fquad-piaf](https://huggingface.co/etalab-ia/camembert-base-squadFR-fquad-piaf) | 53.60 | 78.09 |
64
+ | QAmembert (previous version) | 54.26 | 77.87 |
65
+ | QAmembert (**this version**) | 53.98 | 78.00 |
66
+ | QAmembert-large ♪ | **55.95** | **81.05** |
67
+ | [fT0](https://huggingface.co/CATIE-AQ/frenchT0) | 41.15 | 65.79 |
68
+
69
+ ♪ this model is available on request only
70
+
71
+ ### qwant/squad_fr (validation)
72
+
73
+ The metric used is Squad v1.
74
+
75
+ | Model | Exact_match | F1-score |
76
+ | ----------- | ----------- | ----------- |
77
+ | [etalab-ia/camembert-base-squadFR-fquad-piaf](https://huggingface.co/etalab-ia/camembert-base-squadFR-fquad-piaf) | 60.17 | 78.27 |
78
+ | QAmembert (previous version) | 60.40 | 77.27 |
79
+ | QAmembert (**this version**) | 60.95 | 77.30 |
80
+ | QAmembert-large ♪ | **65.58** | **81.74** |
81
+ | [fT0](https://huggingface.co/CATIE-AQ/frenchT0) | 41.05 | 56.14 |
82
+
83
+ ♪ this model is available on request only.
84
+
85
+ ### frenchQA
86
+
87
+ This dataset includes question with no answers in the context. The metric used is Squad v2.
88
+
89
+ | Model | Exact_match | F1-score | Answer_f1 | NoAnswer_f1 |
90
+ | ----------- | ----------- | ----------- | ----------- | ----------- |
91
+ | [etalab-ia/camembert-base-squadFR-fquad-piaf](https://huggingface.co/etalab-ia/camembert-base-squadFR-fquad-piaf) | n/a | n/a | n/a | n/a |
92
+ | QAmembert (previous version) | 60.28 | 71.29 | 75.92 | 66.65
93
+ | QAmembert (**this version**) | **77.14** | 86.88 | 75.66 | 98.11
94
+ | QAmembert-large ♪ | **77.14** | **88.74** | **78.83** | **98.65**
95
+
96
+ ♪ this model is available on request only.
97
+
98
+ ## Usage
99
+ ### Example with answer in the context
100
+
101
+ ```python
102
+ from transformers import pipeline
103
+
104
+ qa = pipeline('question-answering', model='CATIE-AQ/QAmembert', tokenizer='CATIE-AQ/QAmembert')
105
+
106
+ result = qa({
107
+ 'question': "Combien de personnes utilisent le français tous les jours ?",
108
+ '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."
109
+ })
110
+
111
+ if result['score'] < 0.01:
112
+ print("La réponse n'est pas dans le contexte fourni.")
113
+ else :
114
+ print(result['answer'])
115
+ ```
116
+ ```python
117
+ 235 millions
118
+ ```
119
+ ```python
120
+ # details
121
+ result
122
+ {'score': 0.9945194721221924,
123
+ 'start': 269,
124
+ 'end': 281,
125
+ 'answer': '235 millions'}
126
+ ```
127
+
128
+
129
+ ### Example with answer not in the context
130
+ ```python
131
+ from transformers import pipeline
132
+
133
+ qa = pipeline('question-answering', model='CATIE-AQ/QAmembert', tokenizer='CATIE-AQ/QAmembert')
134
+
135
+ result = qa({
136
+ 'question': "Quel est le meilleur vin du monde ?",
137
+ '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.
138
+ 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."
139
+ })
140
+
141
+ if result['score'] < 0.01:
142
+ print("La réponse n'est pas dans le contexte fourni.")
143
+ else :
144
+ print(result['answer'])
145
+ ```
146
+ ```python
147
+ La réponse n'est pas dans le contexte fourni.
148
+ ```
149
+ ```python
150
+ # details
151
+ result
152
+ {'score': 3.619904940035945e-13,
153
+ 'start': 734,
154
+ 'end': 744,
155
+ 'answer': 'visiteurs.'}
156
+ ```
157
+
158
+ ## Environmental Impact
159
+
160
+ *Carbon emissions were estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700). The hardware, runtime, cloud provider, and compute region were utilized to estimate the carbon impact.*
161
+
162
+ - **Hardware Type:** A100 PCIe 40/80GB
163
+ - **Hours used:** 11h and 12min
164
+ - **Cloud Provider:** Private Infrastructure
165
+ - **Carbon Efficiency (kg/kWh):** 0.076kg (estimated from [electricitymaps](https://app.electricitymaps.com/zone/FR) ; 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.)
166
+ - **Carbon Emitted** *(Power consumption x Time x Carbon produced based on location of power grid)*: 0.20 kg eq. CO2
167
+
168
+
169
+ ## Citations
170
+
171
+ ### PIAF
172
+ ```
173
+ @inproceedings{KeraronLBAMSSS20,
174
+ author = {Rachel Keraron and
175
+ Guillaume Lancrenon and
176
+ Mathilde Bras and
177
+ Fr{\'{e}}d{\'{e}}ric Allary and
178
+ Gilles Moyse and
179
+ Thomas Scialom and
180
+ Edmundo{-}Pavel Soriano{-}Morales and
181
+ Jacopo Staiano},
182
+ title = {Project {PIAF:} Building a Native French Question-Answering Dataset},
183
+ booktitle = {{LREC}},
184
+ pages = {5481--5490},
185
+ publisher = {European Language Resources Association},
186
+ year = {2020}
187
+ }
188
+
189
+ ```
190
+
191
+ ### FQuAD
192
+ ```
193
+ @article{dHoffschmidt2020FQuADFQ,
194
+ title={FQuAD: French Question Answering Dataset},
195
+ author={Martin d'Hoffschmidt and Maxime Vidal and Wacim Belblidia and Tom Brendl'e and Quentin Heinrich},
196
+ journal={ArXiv},
197
+ year={2020},
198
+ volume={abs/2002.06071}
199
+ }
200
+ ```
201
+
202
+ ### lincoln/newsquadfr
203
+ ```
204
+ Hugging Face repository : https://huggingface.co/datasets/lincoln/newsquadfr
205
+ ```
206
+
207
+ ### pragnakalp/squad_v2_french_translated
208
+ ```
209
+ Hugging Face repository : https://huggingface.co/datasets/pragnakalp/squad_v2_french_translated
210
+ ```
211
+
212
+ ### CamemBERT
213
+ ```
214
+ @inproceedings{martin2020camembert,
215
+ title={CamemBERT: a Tasty French Language Model},
216
+ 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},
217
+ booktitle={Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics},
218
+ year={2020}
219
+ }
220
+ ```
221
+
222
+ ## License
223
+ [cc-by-4.0](https://creativecommons.org/licenses/by/4.0/deed.en)