🚀 deberta-v3-base-zeroshot-v1
本模型專為使用Hugging Face管道進行零樣本分類而設計,在零樣本分類任務上,相比作者在Hugging Face hub(https://huggingface.co/MoritzLaurer )上的其他零樣本模型,性能有顯著提升。
🚀 快速開始
本模型可完成一項通用任務:給定一段文本,判斷一個假設是true
還是not_true
(也稱為entailment
與not_entailment
)。此任務格式基於自然語言推理任務(NLI),具有很強的通用性,任何分類任務都可轉化為該任務。
✨ 主要特性
- 專為零樣本分類設計,在零樣本分類任務上表現優於作者其他相關模型。
- 基於通用任務格式,可將任何分類任務轉化為此任務進行處理。
- 相比其他NLI模型,該模型僅預測兩個類別(
entailment
與not_entailment
),而非三個類別(entailment/neutral/contradiction)。
📦 安裝指南
暫未提及具體安裝步驟,可參考Hugging Face Transformers庫的安裝方式。
💻 使用示例
基礎用法
from transformers import pipeline
classifier = pipeline("zero-shot-classification", model="MoritzLaurer/deberta-v3-base-zeroshot-v1")
sequence_to_classify = "Angela Merkel is a politician in Germany and leader of the CDU"
candidate_labels = ["politics", "economy", "entertainment", "environment"]
output = classifier(sequence_to_classify, candidate_labels, multi_label=False)
print(output)
📚 詳細文檔
訓練數據
該模型在27個任務和310個類別的混合數據上進行訓練,這些數據已被重新格式化為通用格式:
- 26個分類任務,約400k文本:
'amazonpolarity', 'imdb', 'appreviews', 'yelpreviews', 'rottentomatoes',
'emotiondair', 'emocontext', 'empathetic',
'financialphrasebank', 'banking77', 'massive',
'wikitoxic_toxicaggregated', 'wikitoxic_obscene', 'wikitoxic_threat', 'wikitoxic_insult', 'wikitoxic_identityhate',
'hateoffensive', 'hatexplain', 'biasframes_offensive', 'biasframes_sex', 'biasframes_intent',
'agnews', 'yahootopics',
'trueteacher', 'spam', 'wellformedquery'。
每個數據集的詳細信息請見:https://docs.google.com/spreadsheets/d/1Z18tMh02IiWgh6o8pfoMiI_LH4IXpr78wd_nmNd5FaE/edit?usp=sharing
- 五個NLI數據集,約885k文本:"mnli", "anli", "fever", "wanli", "ling"
數據和訓練詳情
數據準備、模型訓練和評估的代碼完全開源,可查看:https://github.com/MoritzLaurer/zeroshot-classifier/tree/main
侷限性和偏差
該模型僅能處理文本分類任務。有關潛在偏差,請參考原始DeBERTa論文以及不同數據集的相關論文。
許可證
基礎模型(DeBERTa-v3)遵循MIT許可證發佈。模型微調所用的數據集遵循多種不同的許可證。以下電子表格提供了用於微調的非NLI數據集的概述,包含許可證、相關論文等信息:https://docs.google.com/spreadsheets/d/1Z18tMh02IiWgh6o8pfoMiI_LH4IXpr78wd_nmNd5FaE/edit?usp=sharing
此外,模型還在以下NLI數據集上進行了訓練:MNLI、ANLI、WANLI、LING-NLI、FEVER-NLI。
引用
如果使用此模型,請引用:
@article{laurer_less_2023,
title = {Less {Annotating}, {More} {Classifying}: {Addressing} the {Data} {Scarcity} {Issue} of {Supervised} {Machine} {Learning} with {Deep} {Transfer} {Learning} and {BERT}-{NLI}},
issn = {1047-1987, 1476-4989},
shorttitle = {Less {Annotating}, {More} {Classifying}},
url = {https://www.cambridge.org/core/product/identifier/S1047198723000207/type/journal_article},
doi = {10.1017/pan.2023.20},
language = {en},
urldate = {2023-06-20},
journal = {Political Analysis},
author = {Laurer, Moritz and Van Atteveldt, Wouter and Casas, Andreu and Welbers, Kasper},
month = jun,
year = {2023},
pages = {1--33},
}
合作建議或疑問
如果您有合作想法或疑問,請通過m{dot}laurer{at}vu{dot}nl聯繫作者,或訪問LinkedIn。
調試和問題
請注意,DeBERTa-v3於2021年12月6日發佈,較舊版本的HF Transformers庫在運行該模型時可能會出現問題(例如分詞器相關問題)。使用Transformers >= 4.13版本可能會解決部分問題。
🔧 技術細節
該模型基於自然語言推理任務(NLI)的通用任務格式進行設計,通過將各種分類任務轉化為判斷假設是否成立的任務,實現零樣本分類。在訓練過程中,使用了多種分類任務和NLI數據集的混合數據,以提升模型的泛化能力。
📄 許可證
基礎模型(DeBERTa-v3)遵循MIT許可證發佈。模型微調所用的數據集遵循多種不同的許可證,具體信息可參考:https://docs.google.com/spreadsheets/d/1Z18tMh02IiWgh6o8pfoMiI_LH4IXpr78wd_nmNd5FaE/edit?usp=sharing 。
📦 模型信息
屬性 |
詳情 |
模型類型 |
用於零樣本分類的DeBERTa-v3-base模型 |
訓練數據 |
26個分類任務(約400k文本)和5個NLI數據集(約885k文本) |
⚠️ 重要提示
較舊版本的HF Transformers庫在運行該模型時可能會出現問題,使用Transformers >= 4.13版本可能會解決部分問題。
💡 使用建議
若有合作想法或疑問,可通過m{dot}laurer{at}vu{dot}nl聯繫作者,或訪問LinkedIn。