🚀 Deberta-v3-base零样本分类模型
本模型基于deberta-v3-base
,在tasksource
上进行了25万步的微调,在许多任务上展现出了强大的零样本验证性能。可用于零样本基于蕴含关系的分类、自然语言推理以及在新任务或任务源任务上的进一步微调。
✨ 主要特性
- 多任务微调:基于
deberta-v3-base
,在众多数据集上进行了微调,包括长文本自然语言推理任务、逻辑推理任务、事实验证任务等。
- 强大的零样本性能:在许多任务上有出色的零样本验证表现,如在WNLI上达到70%的准确率。
- 多种应用场景:可用于零样本分类、自然语言推理、进一步微调等。
📦 安装指南
使用本模型前,你需要安装transformers
和tasknet
库:
pip install transformers tasknet
💻 使用示例
基础用法
[ZS] 零样本分类管道
from transformers import pipeline
classifier = pipeline("zero-shot-classification",model="tasksource/deberta-base-long-nli")
text = "one day I will see the world"
candidate_labels = ['travel', 'cooking', 'dancing']
classifier(text, candidate_labels)
此模型的自然语言推理训练数据包含label-nli,这是一个专门为提升此类零样本分类性能而构建的自然语言推理数据集。
[NLI] 自然语言推理管道
from transformers import pipeline
pipe = pipeline("text-classification",model="tasksource/deberta-base-long-nli")
pipe([dict(text='there is a cat',
text_pair='there is a black cat')])
高级用法
[TA] 任务源适配器:一键访问数百个任务
import tasknet as tn
pipe = tn.load_pipeline('tasksource/deberta-base-long-nli','glue/sst2')
pipe(['That movie was great !', 'Awful movie.'])
任务列表可在模型的config.json
文件中查看。这种方式比零样本分类更高效,因为每个示例只需要一次前向传播,但灵活性较差。
[FT] 任务网络:三行代码实现微调
import tasknet as tn
hparams=dict(model_name='tasksource/deberta-base-long-nli', learning_rate=2e-5)
model, trainer = tn.Model_Trainer([tn.AutoTask("glue/rte")], hparams)
trainer.train()
📚 详细文档
模型信息
属性 |
详情 |
基础模型 |
deberta-v3-base |
训练数据集 |
anli, nli_fever, FOLIO, ConTRoL-nli等众多数据集 |
库名称 |
transformers |
管道标签 |
zero-shot-classification |
标签 |
text-classification, zero-shot-classification |
许可证 |
apache-2.0 |
模型性能
数据集 |
准确率 |
anli/a1 |
63.3 |
anli/a2 |
47.2 |
anli/a3 |
49.4 |
nli_fever |
79.4 |
FOLIO |
61.8 |
ConTRoL-nli |
63.3 |
cladder |
71.1 |
zero-shot-label-nli |
74.4 |
chatbot_arena_conversations |
72.2 |
oasst2_pairwise_rlhf_reward |
73.9 |
doc-nli |
90.0 |
零样本GPT - 4在FOLIO(逻辑推理)上得分为61%,在cladder(概率推理)上得分为62%,在ConTRoL(长文本自然语言推理)上得分为56.4%。
📄 许可证
本模型使用apache-2.0
许可证。
📖 引用
更多详细信息请参考文章:
@inproceedings{sileo-2024-tasksource,
title = "tasksource: A Large Collection of {NLP} tasks with a Structured Dataset Preprocessing Framework",
author = "Sileo, Damien",
editor = "Calzolari, Nicoletta and
Kan, Min-Yen and
Hoste, Veronique and
Lenci, Alessandro and
Sakti, Sakriani and
Xue, Nianwen",
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",
}