🚀 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",
}