🚀 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