🚀 deberta-v3-base-zeroshot-v1
このモデルは、Hugging Faceのパイプラインを用いたゼロショット分類に特化して設計されています。Hugging Faceハブ上の他のゼロショットモデル(https://huggingface.co/MoritzLaurer )と比較して、ゼロショット分類において大幅に優れた性能を発揮します。
🚀 クイックスタート
このモデルは、与えられたテキストに基づいて、仮説が true
または not_true
であるかを判断するという汎用的なタスクを実行できます(これは entailment
と not_entailment
とも呼ばれます)。このタスク形式は自然言語推論タスク(NLI)に基づいており、あらゆる分類タスクをこの形式に変換することができます。
✨ 主な機能
- ゼロショット分類に特化した設計。
- 汎用的なタスク形式で、あらゆる分類タスクを処理可能。
- 他のNLIモデルとは異なり、2クラス(
entailment
と not_entailment
)を予測。
📦 インストール
このモデルはHugging Faceのパイプラインを通じて使用できます。以下のコードを実行することで、簡単にゼロショット分類を行うことができます。
💻 使用例
基本的な使用法
from transformers import pipeline
classifier = pipeline("zero-shot-classification", model="MoritzLaurer/deberta-v3-base-zeroshot-v1")
sequence_to_classify = "Angela Merkel is a politician in Germany and leader of the CDU"
candidate_labels = ["politics", "economy", "entertainment", "environment"]
output = classifier(sequence_to_classify, candidate_labels, multi_label=False)
print(output)
📚 ドキュメント
モデルの説明
このモデルは、Hugging Faceのパイプラインを用いたゼロショット分類に特化して設計されています。Hugging Faceハブ上の他のゼロショットモデル(https://huggingface.co/MoritzLaurer )と比較して、ゼロショット分類において大幅に優れた性能を発揮します。
学習データ
このモデルは、27のタスクと310のクラスを混合したデータセットで学習されています。具体的には、以下のデータセットが使用されています。
- 約400kのテキストを含む26の分類タスク:
'amazonpolarity', 'imdb', 'appreviews', 'yelpreviews', 'rottentomatoes',
'emotiondair', 'emocontext', 'empathetic',
'financialphrasebank', 'banking77', 'massive',
'wikitoxic_toxicaggregated', 'wikitoxic_obscene', 'wikitoxic_threat', 'wikitoxic_insult', 'wikitoxic_identityhate',
'hateoffensive', 'hatexplain', 'biasframes_offensive', 'biasframes_sex', 'biasframes_intent',
'agnews', 'yahootopics',
'trueteacher', 'spam', 'wellformedquery'.
各データセットの詳細はこちらを参照してください: https://docs.google.com/spreadsheets/d/1Z18tMh02IiWgh6o8pfoMiI_LH4IXpr78wd_nmNd5FaE/edit?usp=sharing
- 約885kのテキストを含む5つのNLIデータセット: "mnli", "anli", "fever", "wanli", "ling"
データと学習の詳細
データの準備、モデルの学習と評価に関するコードは、完全にオープンソースで公開されています。詳細はこちらを参照してください: https://github.com/MoritzLaurer/zeroshot-classifier/tree/main
🔧 技術詳細
このモデルは、自然言語推論タスク(NLI)に基づいた汎用的なタスク形式を採用しています。他のNLIモデルとは異なり、2クラス(entailment
と not_entailment
)を予測するように設計されています。
📄 ライセンス
ベースモデル(DeBERTa-v3)はMITライセンスの下で公開されています。モデルがファインチューニングされたデータセットは、様々なライセンスの下で公開されています。ファインチューニングに使用された非NLIデータセットの概要は、以下のスプレッドシートで確認できます。このスプレッドシートには、ライセンス、基礎となる論文などの情報が含まれています: https://docs.google.com/spreadsheets/d/1Z18tMh02IiWgh6o8pfoMiI_LH4IXpr78wd_nmNd5FaE/edit?usp=sharing
また、このモデルは以下のNLIデータセットでも学習されています: MNLI, ANLI, WANLI, LING-NLI, FEVER-NLI。
引用
このモデルを使用する場合は、以下を引用してください:
@article{laurer_less_2023,
title = {Less {Annotating}, {More} {Classifying}: {Addressing} the {Data} {Scarcity} {Issue} of {Supervised} {Machine} {Learning} with {Deep} {Transfer} {Learning} and {BERT}-{NLI}},
issn = {1047-1987, 1476-4989},
shorttitle = {Less {Annotating}, {More} {Classifying}},
url = {https://www.cambridge.org/core/product/identifier/S1047198723000207/type/journal_article},
doi = {10.1017/pan.2023.20},
language = {en},
urldate = {2023-06-20},
journal = {Political Analysis},
author = {Laurer, Moritz and Van Atteveldt, Wouter and Casas, Andreu and Welbers, Kasper},
month = jun,
year = {2023},
pages = {1--33},
}
協力のアイデアや質問がある場合
協力のアイデアや質問がある場合は、m{dot}laurer{at}vu{dot}nl または LinkedIn までご連絡ください。
デバッグと問題点
DeBERTa-v3は2021年12月6日にリリースされましたが、古いバージョンのHF Transformersではモデルを実行する際に問題が発生する場合があります(例えば、トークナイザに関する問題が発生することがあります)。Transformers>=4.13を使用することで、一部の問題を解決できる可能性があります。