🚀 drama-large-xnli-anli
このモデルは、XNLIとANLIデータセットでfacebook/drama-largeをファインチューニングしたバージョンです。
🚀 クイックスタート
モデルの説明
DRAMA: Diverse Augmentation from Large Language Models to Smaller Dense Retrievers
Xueguang Ma, Xi Victoria Lin, Barlas Oguz, Jimmy Lin, Wen-tau Yih, Xilun Chen, arXiv 2025
モデルの使用方法
ゼロショット分類パイプラインを使用する場合
モデルはzero-shot-classification
パイプラインを使って以下のように読み込むことができます。
from transformers import AutoTokenizer, pipeline
model = "mjwong/drama-large-xnli-anli"
classifier = pipeline("zero-shot-classification",
model=model)
このパイプラインを使って、指定したクラス名のいずれかにシーケンスを分類することができます。
sequence_to_classify = "one day I will see the world"
candidate_labels = ['travel', 'cooking', 'dancing']
classifier(sequence_to_classify, candidate_labels)
複数の候補ラベルが正しい場合、multi_class=True
を渡して各クラスを独立して計算することができます。
candidate_labels = ['travel', 'cooking', 'dancing', 'exploration']
classifier(sequence_to_classify, candidate_labels, multi_class=True)
手動でPyTorchを使用する場合
モデルは以下のようにNLIタスクに適用することもできます。
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
model_name = "mjwong/drama-large-xnli-anli"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
premise = "But I thought you'd sworn off coffee."
hypothesis = "I thought that you vowed to drink more coffee."
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", "neutral", "contradiction"]
prediction = {name: round(float(pred) * 100, 2) for pred, name in zip(prediction, label_names)}
print(prediction)
評価結果
このモデルは、XNLIのテストセットを使用して15の言語で評価されました。使用された指標は正解率です。
Datasets |
en |
ar |
bg |
de |
el |
es |
fr |
hi |
ru |
sw |
th |
tr |
ur |
vi |
zh |
drama-base-xnli-anli |
0.788 |
0.689 |
0.708 |
0.715 |
0.696 |
0.732 |
0.737 |
0.647 |
0.711 |
0.636 |
0.676 |
0.664 |
0.588 |
0.708 |
0.710 |
drama-large-xnli-anli |
0.799 |
0.698 |
0.730 |
0.721 |
0.717 |
0.754 |
0.754 |
0.649 |
0.718 |
0.652 |
0.678 |
0.656 |
0.594 |
0.719 |
0.719 |
このモデルは、MultiNLIの開発セットとANLIのテストセットを使用しても評価されました。使用された指標は正解率です。
学習ハイパーパラメータ
学習中に以下のハイパーパラメータが使用されました。
- learning_rate: 2e-05
- train_batch_size: 16
- eval_batch_size: 16
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- lr_scheduler_warmup_ratio: 0.1
フレームワークのバージョン
- Transformers 4.49.0
- Pytorch 2.6.0+cu124
- Datasets 3.2.0
- Tokenizers 0.21.0
📄 ライセンス
このモデルのライセンスはCC BY-NC 4.0です。
📦 データセット
このモデルの学習には、以下のデータセットが使用されました。
📚 パイプラインタグ
このモデルのパイプラインタグはzero-shot-classification
です。
🔧 ベースモデル
このモデルのベースモデルはfacebook/drama-largeです。
Property |
Details |
Model Type |
drama-large-xnli-anli |
Training Data |
xnli, facebook/anli |
Pipeline Tag |
zero-shot-classification |
Base Model |
facebook/drama-large |
License |
cc-by-nc-4.0 |