🚀 英語における非事実型質問カテゴリ分類
このプロジェクトは、英語の非事実型質問(NFQA)を分類するモデルに関するものです。NFQAモデルは特定のデータセットで学習され、質問のカテゴリを精度よく判断することができます。
🚀 クイックスタート
NFQAモデルについて
リポジトリ: https://github.com/Lurunchik/NF-CATS
このモデルはNFQAデータセットを使用して学習されています。ベースモデルはroberta-base-squad2で、SQuAD2.0データセットを用いて微調整された質問応答タスク向けのRoBERTaベースのモデルです。
以下のラベルを使用して質問を分類します:
NOT-A-QUESTION
、FACTOID
、DEBATE
、EVIDENCE-BASED
、INSTRUCTION
、REASON
、EXPERIENCE
、COMPARISON
📦 インストール
このセクションでは、HuggingFaceを使用してNFQAモデルを使う方法を説明します。
NFQAモデルとトークナイザーの読み込み
from transformers import AutoTokenizer
from nfqa_model import RobertaNFQAClassification
nfqa_model = RobertaNFQAClassification.from_pretrained("Lurunchik/nf-cats")
nfqa_tokenizer = AutoTokenizer.from_pretrained("deepset/roberta-base-squad2")
ヘルパー関数を使用した予測
def get_nfqa_category_prediction(text):
output = nfqa_model(**nfqa_tokenizer(text, return_tensors="pt"))
index = output.logits.argmax()
return nfqa_model.config.id2label[int(index)]
get_nfqa_category_prediction('how to assign category?')
💻 使用例
基本的な使用法
from transformers import AutoTokenizer
from nfqa_model import RobertaNFQAClassification
nfqa_model = RobertaNFQAClassification.from_pretrained("Lurunchik/nf-cats")
nfqa_tokenizer = AutoTokenizer.from_pretrained("deepset/roberta-base-squad2")
def get_nfqa_category_prediction(text):
output = nfqa_model(**nfqa_tokenizer(text, return_tensors="pt"))
index = output.logits.argmax()
return nfqa_model.config.id2label[int(index)]
get_nfqa_category_prediction('how to assign category?')
📚 ドキュメント
デモ
hugginface spaceを通じてモデルをテストすることができます。

引用
もしあなたの研究やプロジェクトでNFQA-cats
を使用する場合は、この論文を引用してください。
@misc{bolotova2022nfcats,
author = {Bolotova, Valeriia and Blinov, Vladislav and Scholer, Falk and Croft, W. Bruce and Sanderson, Mark},
title = {A Non-Factoid Question-Answering Taxonomy},
year = {2022},
isbn = {9781450387323},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3477495.3531926},
doi = {10.1145/3477495.3531926},
booktitle = {Proceedings of the 45th International ACM SIGIR Conference on Research and Development in Information Retrieval},
pages = {1196–1207},
numpages = {12},
keywords = {question taxonomy, non-factoid question-answering, editorial study, dataset analysis},
location = {Madrid, Spain},
series = {SIGIR '22}
}
Enjoy! 🤗
📄 ライセンス
このプロジェクトはMITライセンスの下で公開されています。