NOTE
Deprecated: use deberta-small-long-nli for longer context and better accuracy.
This is [DeBERTa-v3-base] fine-tuned with multi-task learning on 600+ tasks of the [tasksource collection]. This checkpoint has strong zero-shot validation performance on many tasks (e.g. 70% on WNLI), and can be used for:
import argparse
import torch
from openmind import pipeline, is_torch_npu_available
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--model_name_or_path",
default=None,
type=str,
help="Path to model",
required=False,
)
args = parser.parse_args()
return args
if __name__=="__main__":
args = parse_args()
if is_torch_npu_available():
device = "npu:0"
else:
device = "cpu"
#推理
classifier = pipeline(
task="zero-shot-classification",
model=args.model_name_or_path,
device=device
)
text = "one day I will see the world"
candidate_labels = ['travel', 'cooking', 'dancing']
print(classifier(text, candidate_labels))NLI training data of this model includes [label-nli], a NLI dataset specially constructed to improve this kind of zero-shot classification.
import argparse
import torch
from openmind import pipeline, is_torch_npu_available
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--model_name_or_path",
default=None,
type=str,
help="Path to model",
required=False,
)
args = parser.parse_args()
return args
if __name__=="__main__":
args = parse_args()
if is_torch_npu_available():
device = "npu:0"
else:
device = "cpu"
#推理
pipe = pipeline('text-classification', model=args.model_name_or_path, device=device)
print(pipe([dict(text='there is a cat',text_pair='there is a black cat')]))This model ranked 1st among all models with the microsoft/deberta-v3-base architecture according to the IBM model recycling evaluation. https://ibm.github.io/model-recycling/
The model was trained on 600 tasks for 200k steps with a batch size of 384 and a peak learning rate of 2e-5. Training took 15 days on Nvidia A30 24GB gpu. This is the shared model with the MNLI classifier on top. Each task had a specific CLS embedding, which is dropped 10% of the time to facilitate model use without it. All multiple-choice model used the same classification layers. For classification tasks, models shared weights if their labels matched.
https://github.com/sileod/tasksource/
https://github.com/sileod/tasknet/
Training code: https://colab.research.google.com/drive/1iB4Oxl9_B5W3ZDzXoWJN-olUbqLBxgQS?usp=sharing
More details on this article:
@article{sileo2023tasksource,
title={tasksource: Structured Dataset Preprocessing Annotations for Frictionless Extreme Multi-Task Learning and Evaluation},
author={Sileo, Damien},
url= {https://arxiv.org/abs/2301.05948},
journal={arXiv preprint arXiv:2301.05948},
year={2023}
}