🚀 DeBERTa-v3-small-tasksource-nli模型卡片
本项目基于DeBERTa-v3-small模型,在tasksource上进行了25万步的微调,适用于长上下文自然语言推理(NLI)任务,也可作为奖励模型或分类器微调的基础模型。该模型在许多任务上都有出色的零样本验证性能。
🚀 快速开始
零样本分类
from transformers import pipeline
classifier = pipeline("zero-shot-classification",model="tasksource/deberta-small-long-nli")
text = "one day I will see the world"
candidate_labels = ['travel', 'cooking', 'dancing']
classifier(text, candidate_labels)
自然语言推理
from transformers import pipeline
pipe = pipeline("text-classification",model="tasksource/deberta-small-long-nli")
pipe([dict(text='there is a cat',
text_pair='there is a black cat')])
任务网络微调
import tasknet as tn
hparams=dict(model_name='tasksource/deberta-small-long-nli', learning_rate=2e-5)
model, trainer = tn.Model_Trainer([tn.AutoTask("glue/rte")], hparams)
trainer.train()
✨ 主要特性
- 长上下文处理能力:能够处理上下文长度达1680个标记的文本。
- 多任务适用性:适用于自然语言推理、零样本分类等多种任务,也可作为奖励模型或分类器进行进一步微调。
- 出色的零样本性能:在许多任务上具有强大的零样本验证性能,例如在WNLI任务上达到70%的准确率。
📦 安装指南
运行代码示例前,请确保安装了必要的库:
pip install transformers tasknet
💻 使用示例
基础用法
零样本分类
from transformers import pipeline
classifier = pipeline("zero-shot-classification",model="tasksource/deberta-small-long-nli")
text = "one day I will see the world"
candidate_labels = ['travel', 'cooking', 'dancing']
classifier(text, candidate_labels)
自然语言推理
from transformers import pipeline
pipe = pipeline("text-classification",model="tasksource/deberta-small-long-nli")
pipe([dict(text='there is a cat',
text_pair='there is a black cat')])
任务网络微调
import tasknet as tn
hparams=dict(model_name='tasksource/deberta-small-long-nli', learning_rate=2e-5)
model, trainer = tn.Model_Trainer([tn.AutoTask("glue/rte")], hparams)
trainer.train()
📚 详细文档
模型评估结果
测试名称 |
准确率 |
anli/a1 |
57.2 |
anli/a2 |
46.1 |
anli/a3 |
47.2 |
nli_fever |
71.7 |
FOLIO |
47.1 |
ConTRoL-nli |
52.2 |
cladder |
52.8 |
zero-shot-label-nli |
70.0 |
chatbot_arena_conversations |
67.8 |
oasst2_pairwise_rlhf_reward |
75.6 |
doc-nli |
75.0 |
零样本GPT-4得分
- FOLIO(逻辑推理):61%
- cladder(概率推理):62%
- ConTRoL(长上下文NLI):56.4%
训练数据
模型的训练数据包括以下数据集:
- label-nli:专门为提高零样本分类性能而构建的NLI数据集。
- 其他:HelpSteer v1/v2、逻辑推理任务(FOLIO、FOL-nli、LogicNLI等)、OASST、hh/rlhf、面向语言学的NLI任务、tasksource-dpo、事实验证任务等。
软件和训练细节
- 训练任务数量:600个
- 训练步数:25万步
- 批次大小:384
- 峰值学习率:2e-5
- 训练时长:在Nvidia A30 24GB GPU上训练14天
- 模型结构:与MNLI分类器共享模型,每个任务有特定的CLS嵌入,为方便模型在无CLS嵌入的情况下使用,CLS嵌入有10%的概率被丢弃。所有多项选择模型使用相同的分类层,分类任务中标签匹配的模型共享权重。
相关链接
🔧 技术细节
模型基于DeBERTa-v3-small进行微调,在600个任务上进行了25万步的训练,使用了特定的训练策略和数据增强方法,以提高模型在多种任务上的性能。
📄 许可证
本模型遵循Apache 2.0许可证。
📖 引用
如需引用本模型,请使用以下BibTeX格式:
@inproceedings{sileo-2024-tasksource,
title = "tasksource: A Large Collection of {NLP} tasks with a Structured Dataset Preprocessing Framework",
author = "Sileo, Damien",
booktitle = "Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024)",
month = may,
year = "2024",
address = "Torino, Italia",
publisher = "ELRA and ICCL",
url = "https://aclanthology.org/2024.lrec-main.1361",
pages = "15655--15684",
}
📞 联系信息
如有任何问题或建议,请联系:damien.sileo@inria.fr