モデル概要
モデル特徴
モデル能力
使用事例
🚀 QAmembert
QAmemBERT は、フランス語の質問応答タスク向けに微調整されたモデルです。このモデルは、4つのフランス語のQ&Aデータセットを用いて、CamemBERT base を微調整したものです。これらのデータセットは、文脈と質問、そして文脈内に回答が含まれる形式(= SQuAD 1.0形式)や、文脈内に回答が含まれない形式(= SQuAD 2.0形式)を持っています。
🚀 クイックスタート
このモデルは、フランス語の質問応答タスクに最適化されています。以下のセクションでは、モデルの詳細、使用例、評価結果などを説明します。
✨ 主な機能
- 質問応答タスク向け:フランス語の質問に対する回答を生成します。
- 多様なデータセットでの微調整:4つのフランス語のQ&Aデータセットを用いて微調整されています。
- 高い精度:評価結果によると、高いF1スコアと正解率を達成しています。
📦 インストール
このモデルは、Hugging Faceの transformers
ライブラリを使用して利用できます。以下のコマンドでインストールできます。
pip install transformers
💻 使用例
基本的な使用法
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'}
高度な使用法
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.'}
オンラインで試す
モデルをテストするためのSpaceが作成されています。こちらからアクセスできます。
📚 ドキュメント
モデルの説明
QAmemBERT は、CamemBERT base をフランス語の質問応答タスク向けに微調整したモデルです。4つのフランス語のQ&Aデータセットを用いて微調整されており、これらのデータセットは、文脈と質問、そして文脈内に回答が含まれる形式(= SQuAD 1.0形式)や、文脈内に回答が含まれない形式(= SQuAD 2.0形式)を持っています。
データセット
データセット | 形式 | 訓練分割 | 開発分割 | テスト分割 |
---|---|---|---|---|
piaf | SQuAD 1.0 | 9 224 Q & A | X | X |
piaf_v2 | SQuAD 2.0 | 9 224 Q & A | X | X |
fquad | SQuAD 1.0 | 20 731 Q & A | 3 188 Q & A (訓練には使用されていません。テストデータセットとして使用されています。) | 2 189 Q & A (この作業では使用されていません。無料で入手できないため。) |
fquad_v2 | SQuAD 2.0 | 20 731 Q & A | 3 188 Q & A (訓練には使用されていません。テストデータセットとして使用されています。) | X |
lincoln/newsquadfr | SQuAD 1.0 | 1 650 Q & A | 455 Q & A (この作業では使用されていません。) | X |
lincoln/newsquadfr_v2 | SQuAD 2.0 | 1 650 Q & A | 455 Q & A (この作業では使用されていません。) | X |
pragnakalp/squad_v2_french_translated | SQuAD 2.0 | 79 069 Q & A | X | X |
pragnakalp/squad_v2_french_translated_v2 | SQuAD 2.0 | 79 069 Q & A | X | X |
これらのデータセットは、1つのデータセットに結合され、frenchQA と名付けられました。
評価結果
評価は、evaluate Pythonパッケージを使用して行われました。
FQuaD 1.0 (検証)
使用されたメトリックはSQuAD 1.0です。
モデル | 正解率 | F1スコア |
---|---|---|
etalab-ia/camembert-base-squadFR-fquad-piaf | 53.60 | 78.09 |
QAmembert (前のバージョン) | 54.26 | 77.87 |
QAmembert (このバージョン) | 53.98 | 78.00 |
QAmembert-large | 55.95 | 81.05 |
qwant/squad_fr (検証)
使用されたメトリックはSQuAD 1.0です。
モデル | 正解率 | F1スコア |
---|---|---|
etalab-ia/camembert-base-squadFR-fquad-piaf | 60.17 | 78.27 |
QAmembert (前のバージョン) | 60.40 | 77.27 |
QAmembert (このバージョン) | 60.95 | 77.30 |
QAmembert-large | 65.58 | 81.74 |
frenchQA
このデータセットには、文脈内に回答が含まれない質問が含まれています。使用されたメトリックはSQuAD 2.0です。
モデル | 正解率 | F1スコア | 回答F1 | 無回答F1 |
---|---|---|---|---|
etalab-ia/camembert-base-squadFR-fquad-piaf | n/a | n/a | n/a | n/a |
QAmembert (前のバージョン) | 60.28 | 71.29 | 75.92 | 66.65 |
QAmembert (このバージョン) | 77.14 | 86.88 | 75.66 | 98.11 |
QAmembert-large | 77.14 | 88.74 | 78.83 | 98.65 |
🔧 技術詳細
環境への影響
炭素排出量は、Lacoste et al. (2019) で提示された Machine Learning Impact calculator を使用して推定されました。ハードウェア、実行時間、クラウドプロバイダー、およびコンピュートリージョンが、炭素影響の推定に使用されました。
- ハードウェアタイプ: A100 PCIe 40/80GB
- 使用時間: 5時間36分
- クラウドプロバイダー: プライベートインフラストラクチャ
- 炭素効率 (kg/kWh): 0.076kg ( electricitymaps から推定。2023年3月のフランスの平均炭素強度を使用しています。訓練日のデータは利用できないためです。)
- 排出された炭素 (消費電力 x 時間 x 電力網の場所に基づく炭素排出量): 0.1 kg eq. CO2
📄 ライセンス
このモデルは、MITライセンスの下で公開されています。
引用
QAmemBERT
@misc {qamembert2023,
author = { {ALBAR, Boris and BEDU, Pierre and BOURDOIS, Loïck} },
organization = { {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 = { Hugging Face }
}
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
Hugging Face repository: https://hf.co/datasets/lincoln/newsquadfr
pragnakalp/squad_v2_french_translated
Hugging Face repository: https://hf.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}
}









