ns-gradio-apps / task.py
nsethi610's picture
Create task.py
b8dad8b verified
raw
history blame
2.11 kB
class Task:
def __init__(self, label, name) -> None:
self.name = name
self.label = label
self.models = []
self.examples = []
def initialize(self, models, examples):
self.models = models
self.examples = examples
def __str__(self) -> str:
return f"Name: {self.name}, Label: {self.label}, Models: {self.models}, examples: {self.examples}"
tasks_config = {
"text-generation": {"name": "Text Generation", "config": {
"models": ["meta-llama/Llama-2-7b-chat-hf", "mistralai/Mixtral-8x7B-Instruct-v0.1"]
}, "info": " The idea here is that you provide a prompt and the model will auto-complete it by generating the remaining text. This is similar to the predictive text feature that is found on many phones. Text generation involves randomness, so it’s normal if you don’t get the desired results."
},
"fill-mask": {"name": "Fill Mask", "config": {
"models": ["google-bert/bert-base-uncased", "distilbert/distilbert-base-uncased"]
}, "info": "The idea of this task is to fill in the blanks in a given text. Example: This course will teach you all about <mask> models. and pipeline would try to predict <mask>."},
"summarization": {"name": "Summarization", "config": {
"models": ["facebook/bart-large-cnn", "Falconsai/text_summarization"]
}, "info": "Summarization is the task of reducing a text into a shorter text while keeping all (or most) of the important aspects referenced in the text"},
"ner": {"name": "Named Entity Recognition", "config": {
"models": ["dslim/bert-base-NER", "Jean-Baptiste/roberta-large-ner-english"]
}, "info": "Named entity recognition (ner) is a task where the model has to find which parts of the input text correspond to entities such as persons, locations, or organizations."},
"question-answering": {"name": "Question Answering", "config": {
"models": ["deepset/roberta-base-squad2", "timpal0l/mdeberta-v3-base-squad2"]
}, "info": "The question-answering pipeline answers questions using information from a given context"}
}