Camembert Squadfr Fquad Piaf Answer Extraction
このモデルはCamemBERT-baseをファインチューニングしたもので、フランス語テキストからの回答抽出タスク専用に設計されており、SquadFR、FQuAD、PIAFデータセットで訓練されています。
ダウンロード数 16
リリース時間 : 3/2/2022
モデル概要
これはトークン分類モデルで、フランス語テキスト内で質問の回答として可能性のあるトークンシーケンスを識別します。モデルは'ANS'ラベルを付与することで回答位置を特定します。
モデル特徴
フランス語専門最適化
フランス語テキストに特化して最適化された回答抽出モデルで、複数のフランス語Q&Aデータセットでファインチューニングされています
トークンレベル分類
トークン分類手法を採用し、テキスト内の回答開始位置と終了位置を精密に特定します
複数データセット訓練
SquadFR、FQuAD、PIAFの3つのフランス語Q&Aデータセットを組み合わせて訓練されています
モデル能力
フランス語テキスト処理
回答位置識別
トークンシーケンス分類
使用事例
Q&Aシステム
フランス語インテリジェントカスタマーサポート
カスタマーサポート文書から自動的に質問回答を抽出
文書内の関連回答セグメントを識別可能
教育支援
教材から素早く質問回答を見つける学生支援
教材中の知識点位置を精密に特定
情報検索
ドキュメント分析
長文ドキュメントからキー情報セグメントを抽出
全文を人手で読む時間コストを削減
🚀 回答抽出
このモデルは、トークン分類タスクのために、camembert-base モデルからファインチューニングされています。目的は、質問の対象となり得る可能性の高いトークン列を識別することです。
✨ 主な機能
- トークン分類タスクに特化したファインチューニング済みモデル。
- 質問に対する回答となり得るトークン列の識別が可能。
📦 インストール
READMEにインストール手順が記載されていないため、このセクションは省略されます。
📚 ドキュメント
学習データ
学習データセットは、SquadFR、fquad、piaf のデータセットを結合したものです。各コンテキストの回答は "ANS" というラベルでラベル付けされています。
データ量(コンテキスト数):
- トレーニング: 24,652
- テスト: 1,370
- 検証: 1,370
トレーニング
学習はTesla K80のGPU上で行われました。
- バッチサイズ: 16
- ウェイトディケイ: 0.01
- 学習率: 2x10-5(線形減衰)
- TrainingArguments クラスのデフォルトパラメータ
- 総ステップ数: 1,000
これ以上の学習では過学習の傾向が見られます。
クリティック
このモデルは性能が良くなく、予測後に修正する必要があります。分類タスクは、質問が与えられた状況でトークンのグループを識別する必要があるため、容易ではありません。
利用方法
⚠️ 重要提示
このモデルはPOC(概念実証)であり、性能を保証するものではありません。
from transformers import AutoTokenizer, AutoModelForTokenClassification
import numpy as np
model_name = "lincoln/camembert-squadFR-fquad-piaf-answer-extraction"
loaded_tokenizer = AutoTokenizer.from_pretrained(model_path)
loaded_model = AutoModelForTokenClassification.from_pretrained(model_path)
text = "La science des données est un domaine interdisciplinaire qui utilise des méthodes, des processus,\
des algorithmes et des systèmes scientifiques pour extraire des connaissances et des idées de nombreuses données structurelles et non structurées.\
Elle est souvent associée aux données massives et à l'analyse des données."
inputs = loaded_tokenizer(text, return_tensors="pt", return_offsets_mapping=True)
outputs = loaded_model(inputs.input_ids).logits
probs = 1 / (1 + np.exp(-outputs.detach().numpy()))
probs[:, :, 1][0] = np.convolve(probs[:, :, 1][0], np.ones(2), 'same') / 2
sentences = loaded_tokenizer.tokenize(text, add_special_tokens=False)
prob_answer_tokens = probs[:, 1:-1, 1].flatten().tolist()
offset_start_mapping = inputs.offset_mapping[:, 1:-1, 0].flatten().tolist()
offset_end_mapping = inputs.offset_mapping[:, 1:-1, 1].flatten().tolist()
threshold = 0.4
entities = []
for ix, (token, prob_ans, offset_start, offset_end) in enumerate(zip(sentences, prob_answer_tokens, offset_start_mapping, offset_end_mapping)):
entities.append({
'entity': 'ANS' if prob_ans > threshold else 'O',
'score': prob_ans,
'index': ix,
'word': token,
'start': offset_start,
'end': offset_end
})
for p in entities:
print(p)
# {'entity': 'O', 'score': 0.3118681311607361, 'index': 0, 'word': '▁La', 'start': 0, 'end': 2}
# {'entity': 'O', 'score': 0.37866950035095215, 'index': 1, 'word': '▁science', 'start': 3, 'end': 10}
# {'entity': 'ANS', 'score': 0.45018652081489563, 'index': 2, 'word': '▁des', 'start': 11, 'end': 14}
# {'entity': 'ANS', 'score': 0.4615934491157532, 'index': 3, 'word': '▁données', 'start': 15, 'end': 22}
# {'entity': 'O', 'score': 0.35033443570137024, 'index': 4, 'word': '▁est', 'start': 23, 'end': 26}
# {'entity': 'O', 'score': 0.24779987335205078, 'index': 5, 'word': '▁un', 'start': 27, 'end': 29}
# {'entity': 'O', 'score': 0.27084410190582275, 'index': 6, 'word': '▁domaine', 'start': 30, 'end': 37}
# {'entity': 'O', 'score': 0.3259460926055908, 'index': 7, 'word': '▁in', 'start': 38, 'end': 40}
# {'entity': 'O', 'score': 0.371802419424057, 'index': 8, 'word': 'terdisciplinaire', 'start': 40, 'end': 56}
# {'entity': 'O', 'score': 0.3140853941440582, 'index': 9, 'word': '▁qui', 'start': 57, 'end': 60}
# {'entity': 'O', 'score': 0.2629334330558777, 'index': 10, 'word': '▁utilise', 'start': 61, 'end': 68}
# {'entity': 'O', 'score': 0.2968383729457855, 'index': 11, 'word': '▁des', 'start': 69, 'end': 72}
# {'entity': 'O', 'score': 0.33898216485977173, 'index': 12, 'word': '▁méthodes', 'start': 73, 'end': 81}
# {'entity': 'O', 'score': 0.3776060938835144, 'index': 13, 'word': ',', 'start': 81, 'end': 82}
# {'entity': 'O', 'score': 0.3710060119628906, 'index': 14, 'word': '▁des', 'start': 83, 'end': 86}
# {'entity': 'O', 'score': 0.35908180475234985, 'index': 15, 'word': '▁processus', 'start': 87, 'end': 96}
# {'entity': 'O', 'score': 0.3890596628189087, 'index': 16, 'word': ',', 'start': 96, 'end': 97}
# {'entity': 'O', 'score': 0.38341325521469116, 'index': 17, 'word': '▁des', 'start': 101, 'end': 104}
# {'entity': 'O', 'score': 0.3743852376937866, 'index': 18, 'word': '▁', 'start': 105, 'end': 106}
# {'entity': 'O', 'score': 0.3943936228752136, 'index': 19, 'word': 'algorithme', 'start': 105, 'end': 115}
# {'entity': 'O', 'score': 0.39456743001937866, 'index': 20, 'word': 's', 'start': 115, 'end': 116}
# {'entity': 'O', 'score': 0.3846966624259949, 'index': 21, 'word': '▁et', 'start': 117, 'end': 119}
# {'entity': 'O', 'score': 0.367380827665329, 'index': 22, 'word': '▁des', 'start': 120, 'end': 123}
# {'entity': 'O', 'score': 0.3652925491333008, 'index': 23, 'word': '▁systèmes', 'start': 124, 'end': 132}
# {'entity': 'O', 'score': 0.3975735306739807, 'index': 24, 'word': '▁scientifiques', 'start': 133, 'end': 146}
# {'entity': 'O', 'score': 0.36417365074157715, 'index': 25, 'word': '▁pour', 'start': 147, 'end': 151}
# {'entity': 'O', 'score': 0.32438698410987854, 'index': 26, 'word': '▁extraire', 'start': 152, 'end': 160}
# {'entity': 'O', 'score': 0.3416857123374939, 'index': 27, 'word': '▁des', 'start': 161, 'end': 164}
# {'entity': 'O', 'score': 0.3674810230731964, 'index': 28, 'word': '▁connaissances', 'start': 165, 'end': 178}
# {'entity': 'O', 'score': 0.38362061977386475, 'index': 29, 'word': '▁et', 'start': 179, 'end': 181}
# {'entity': 'O', 'score': 0.364640474319458, 'index': 30, 'word': '▁des', 'start': 182, 'end': 185}
# {'entity': 'O', 'score': 0.36050117015838623, 'index': 31, 'word': '▁idées', 'start': 186, 'end': 191}
# {'entity': 'O', 'score': 0.3768993020057678, 'index': 32, 'word': '▁de', 'start': 192, 'end': 194}
# {'entity': 'O', 'score': 0.39184248447418213, 'index': 33, 'word': '▁nombreuses', 'start': 195, 'end': 205}
# {'entity': 'ANS', 'score': 0.4091200828552246, 'index': 34, 'word': '▁données', 'start': 206, 'end': 213}
# {'entity': 'ANS', 'score': 0.41234123706817627, 'index': 35, 'word': '▁structurelle', 'start': 214, 'end': 226}
# {'entity': 'ANS', 'score': 0.40243157744407654, 'index': 36, 'word': 's', 'start': 226, 'end': 227}
# {'entity': 'ANS', 'score': 0.4007353186607361, 'index': 37, 'word': '▁et', 'start': 228, 'end': 230}
# {'entity': 'ANS', 'score': 0.40597623586654663, 'index': 38, 'word': '▁non', 'start': 231, 'end': 234}
# {'entity': 'ANS', 'score': 0.40272021293640137, 'index': 39, 'word': '▁structurée', 'start': 235, 'end': 245}
# {'entity': 'O', 'score': 0.392631471157074, 'index': 40, 'word': 's', 'start': 245, 'end': 246}
# {'entity': 'O', 'score': 0.34266412258148193, 'index': 41, 'word': '.', 'start': 246, 'end': 247}
# {'entity': 'O', 'score': 0.26178646087646484, 'index': 42, 'word': '▁Elle', 'start': 255, 'end': 259}
# {'entity': 'O', 'score': 0.2265639454126358, 'index': 43, 'word': '▁est', 'start': 260, 'end': 263}
# {'entity': 'O', 'score': 0.22844195365905762, 'index': 44, 'word': '▁souvent', 'start': 264, 'end': 271}
# {'entity': 'O', 'score': 0.2475772500038147, 'index': 45, 'word': '▁associée', 'start': 272, 'end': 280}
# {'entity': 'O', 'score': 0.3002186715602875, 'index': 46, 'word': '▁aux', 'start': 281, 'end': 284}
# {'entity': 'O', 'score': 0.3875720798969269, 'index': 47, 'word': '▁données', 'start': 285, 'end': 292}
# {'entity': 'ANS', 'score': 0.445063054561615, 'index': 48, 'word': '▁massive', 'start': 293, 'end': 300}
# {'entity': 'ANS', 'score': 0.4419114589691162, 'index': 49, 'word': 's', 'start': 300, 'end': 301}
# {'entity': 'ANS', 'score': 0.4240635633468628, 'index': 50, 'word': '▁et', 'start': 302, 'end': 304}
# {'entity': 'O', 'score': 0.3900952935218811, 'index': 51, 'word': '▁à', 'start': 305, 'end': 306}
# {'entity': 'O', 'score': 0.3784807324409485, 'index': 52, 'word': '▁l', 'start': 307, 'end': 308}
# {'entity': 'O', 'score': 0.3459452986717224, 'index': 53, 'word': "'", 'start': 308, 'end': 309}
# {'entity': 'O', 'score': 0.37636008858680725, 'index': 54, 'word': 'analyse', 'start': 309, 'end': 316}
# {'entity': 'ANS', 'score': 0.4475618302822113, 'index': 55, 'word': '▁des', 'start': 317, 'end': 320}
# {'entity': 'ANS', 'score': 0.43845775723457336, 'index': 56, 'word': '▁données', 'start': 321, 'end': 328}
# {'entity': 'O', 'score': 0.3761221170425415, 'index': 57, 'word': '.', 'start': 328, 'end': 329}
📄 ライセンス
このプロジェクトはMITライセンスの下で提供されています。
Distilbert Base Cased Distilled Squad
Apache-2.0
DistilBERTはBERTの軽量蒸留バージョンで、パラメータ数が40%減少し、速度が60%向上し、95%以上の性能を維持しています。このモデルはSQuAD v1.1データセットで微調整された質問応答専用バージョンです。
質問応答システム 英語
D
distilbert
220.76k
244
Distilbert Base Uncased Distilled Squad
Apache-2.0
DistilBERTはBERTの軽量蒸留バージョンで、パラメータ数が40%減少し、速度が60%向上し、GLUEベンチマークテストでBERTの95%以上の性能を維持します。このモデルは質問応答タスク用に微調整されています。
質問応答システム
Transformers 英語

D
distilbert
154.39k
115
Tapas Large Finetuned Wtq
Apache-2.0
TAPASはBERTアーキテクチャに基づく表質問応答モデルで、ウィキペディアの表データで自己監督方式により事前学習され、表内容に対する自然言語質問応答をサポート
質問応答システム
Transformers 英語

T
google
124.85k
141
T5 Base Question Generator
t5-baseに基づく質問生成モデルで、答えとコンテキストを入力すると、対応する質問を出力します。
質問応答システム
Transformers

T
iarfmoose
122.74k
57
Bert Base Cased Qa Evaluator
BERT-base-casedに基づく質問と回答のペアの評価モデルで、質問と回答が意味的に関連しているかどうかを判断するために使用されます。
質問応答システム
B
iarfmoose
122.54k
9
Tiny Doc Qa Vision Encoder Decoder
MIT
MITライセンスに基づく文書質問応答モデルで、主にテスト目的で使用されます。
質問応答システム
Transformers

T
fxmarty
41.08k
16
Dpr Question Encoder Single Nq Base
DPR(密集パッセージ検索)はオープンドメイン質問応答研究のためのツールとモデルです。このモデルはBERTベースの質問エンコーダーで、Natural Questions(NQ)データセットでトレーニングされています。
質問応答システム
Transformers 英語

D
facebook
32.90k
30
Mobilebert Uncased Squad V2
MIT
MobileBERTはBERT_LARGEの軽量化バージョンで、SQuAD2.0データセットで微調整された質問応答システムモデルです。
質問応答システム
Transformers 英語

M
csarron
29.11k
7
Tapas Base Finetuned Wtq
Apache-2.0
TAPASはTransformerベースの表質問応答モデルで、ウィキペディアの表データで自己教師あり学習により事前学習され、WTQなどのデータセットでファインチューニングされています。
質問応答システム
Transformers 英語

T
google
23.03k
217
Dpr Question Encoder Multiset Base
BERTベースの密集パラグラフ検索(DPR)の質問エンコーダーで、オープンドメイン質問応答研究に使用され、複数のQAデータセットで訓練されています。
質問応答システム
Transformers 英語

D
facebook
17.51k
4
おすすめAIモデル
Llama 3 Typhoon V1.5x 8b Instruct
タイ語専用に設計された80億パラメータの命令モデルで、GPT-3.5-turboに匹敵する性能を持ち、アプリケーションシナリオ、検索拡張生成、制限付き生成、推論タスクを最適化
大規模言語モデル
Transformers 複数言語対応

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-TinyはSODAデータセットでトレーニングされた超小型対話モデルで、エッジデバイス推論向けに設計されており、体積はCosmo-3Bモデルの約2%です。
対話システム
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
RoBERTaアーキテクチャに基づく中国語抽出型QAモデルで、与えられたテキストから回答を抽出するタスクに適しています。
質問応答システム 中国語
R
uer
2,694
98