forked from foundation-model-stack/fms-dgt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtask.py
36 lines (28 loc) · 1.02 KB
/
task.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Standard
from dataclasses import dataclass
from typing import Any
# Local
from fms_dgt.base.task import SdgData, SdgTask
@dataclass
class InstructLabSdgData(SdgData):
"""This class is intended to hold the seed / machine generated instruction data"""
taxonomy_path: str
task_description: str
instruction: str
input: str
output: str
document: str
class InstructLabSdgTask(SdgTask):
"""This class is intended to hold general task information"""
INPUT_DATA_TYPE = InstructLabSdgData
OUTPUT_DATA_TYPE = InstructLabSdgData
def instantiate_input_example(self, **kwargs: Any):
return self.INPUT_DATA_TYPE(
task_name=self.name,
taxonomy_path=self.name,
task_description=self.task_description,
instruction=kwargs.get("question", kwargs.get("instruction")),
input=kwargs.get("context", kwargs.get("input", "")),
output=kwargs.get("answer", kwargs.get("output")),
document=kwargs.get("document", None),
)