🚀 DeBERTa-v3-xsmall-mnli-fever-anli-ling-binary
このモデルは、ゼロショット分類に特化したモデルで、4つのNLIデータセットからの仮説と前提のペアを用いて学習されています。バイナリNLIで学習され、「entailment」または「not-entailment」を予測するように設計されています。
🚀 クイックスタート
モデルの使用方法
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
model_name = "MoritzLaurer/DeBERTa-v3-xsmall-mnli-fever-anli-ling-binary"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
premise = "I first thought that I liked the movie, but upon second thought it was actually disappointing."
hypothesis = "The movie was good."
input = tokenizer(premise, hypothesis, truncation=True, return_tensors="pt")
output = model(input["input_ids"].to(device))
prediction = torch.softmax(output["logits"][0], -1).tolist()
label_names = ["entailment", "not_entailment"]
prediction = {name: round(float(pred) * 100, 1) for pred, name in zip(prediction, label_names)}
print(prediction)
✨ 主な機能
📦 インストール
このモデルはHugging Faceのライブラリを使用して簡単に利用できます。必要なライブラリをインストールすることで、上記のコード例のように使用できます。
🔧 技術詳細
学習データ
このモデルは、4つのNLIデータセット(MultiNLI、Fever-NLI、LingNLI、ANLI)の782,357の仮説と前提のペアを使用して学習されました。
学習手順
DeBERTa-v3-xsmall-mnli-fever-anli-ling-binaryは、Hugging Faceのトレーナーを使用して以下のハイパーパラメータで学習されました。
training_args = TrainingArguments(
num_train_epochs=5, # total number of training epochs
learning_rate=2e-05,
per_device_train_batch_size=32, # batch size per device during training
per_device_eval_batch_size=32, # batch size for evaluation
warmup_ratio=0.1, # number of warmup steps for learning rate scheduler
weight_decay=0.06, # strength of weight decay
fp16=True # mixed precision training
)
評価結果
このモデルは、MultiNLI、ANLI、LingNLIのバイナリテストセットとFever-NLIのバイナリ開発セット(3クラスではなく2クラス)を使用して評価されました。使用された指標は正解率です。
データセット |
mnli-m-2c |
mnli-mm-2c |
fever-nli-2c |
anli-all-2c |
anli-r3-2c |
lingnli-2c |
正解率 |
0.925 |
0.922 |
0.892 |
0.676 |
0.665 |
0.888 |
速度 (text/sec, CPU, 128バッチ) |
6.0 |
6.3 |
3.0 |
5.8 |
5.0 |
7.6 |
速度 (text/sec, GPU Tesla P100, 128バッチ) |
473 |
487 |
230 |
390 |
340 |
586 |
📄 ライセンス
このモデルはMITライセンスの下で提供されています。
📚 ドキュメント
制限事項とバイアス
潜在的なバイアスについては、元のDeBERTa論文とさまざまなNLIデータセットに関する文献を参照してください。
引用
このモデルを使用する場合は、以下を引用してください。
Laurer, Moritz, Wouter van Atteveldt, Andreu Salleras Casas, and Kasper Welbers. 2022. ‘Less Annotating, More Classifying – Addressing the Data Scarcity Issue of Supervised Machine Learning with Deep Transfer Learning and BERT - NLI’. Preprint, June. Open Science Framework. https://osf.io/74b8k.
協力の提案や質問
協力の提案や質問がある場合は、m{dot}laurer{at}vu{dot}nlまたはLinkedInで連絡してください。
デバッグと問題点
DeBERTa-v3は2021年12月6日にリリースされ、古いバージョンのHF Transformersではモデルを実行する際に問題が発生する可能性があります(例えば、トークナイザーに関する問題が発生することがあります)。Transformers>=4.13を使用することで、一部の問題を解決できる可能性があります。