π pop_qaΒΆ
Note
ID: cards.pop_qa | Type: TaskCard
{
"loader": {
"path": "akariasai/PopQA",
"type": "load_hf"
},
"preprocess_steps": [
{
"page_size": 14267,
"type": "shuffle"
},
{
"_argv": [
"possible_answers"
],
"function": "json.loads",
"to_field": "possible_answers",
"type": "apply"
}
],
"task": {
"inputs": [
"question",
"prop",
"subj"
],
"metrics": [
"metrics.accuracy"
],
"outputs": [
"possible_answers"
],
"type": "form_task"
},
"templates": {
"items": [
{
"input_format": "Answer to the following question. There is no need to explain the reasoning at all. Simply state just the answer in few words. No need for full answer. No need to repeat the question or words from the question. The answer text should be partial and contain only {prop}. Do not use full sentence. \nQuestion: {question}\nThe {prop} of {subj} is:",
"postprocessors": [
"processors.take_first_non_empty_line",
"processors.lower_case"
],
"references_field": "possible_answers",
"type": "multi_reference_template"
}
],
"type": "templates_list"
},
"type": "task_card"
}
Explanation about TaskCardΒΆ
TaskCard delineates the phases in transforming the source dataset into a model-input, and specifies the metrics for evaluation of model-output.
- Attributes:
loader: specifies the source address and the loading operator that can access that source and transform it into a unitxt multistream.
preprocess_steps: list of unitxt operators to process the data source into a model-input.
task: specifies the fields (of the already (pre)processed instance) making the inputs, the fields making the outputs, and the metrics to be used for evaluating the model output.
templates: format strings to be applied on the input fields (specified by the task) and the output fields. The template also carries the instructions and the list of postprocessing steps, to be applied to the model output.
Explanation about FormTaskΒΆ
FormTask packs the different instance fields into dictionaries by their roles in the task.
- Attributes:
- inputs (Union[Dict[str, str], List[str]]):
Dictionary with string names of instance input fields and types of respective values. In case a list is passed, each type will be assumed to be Any.
- outputs (Union[Dict[str, str], List[str]]):
Dictionary with string names of instance output fields and types of respective values. In case a list is passed, each type will be assumed to be Any.
metrics (List[str]): List of names of metrics to be used in the task. prediction_type (Optional[str]):
Need to be consistent with all used metrics. Defaults to None, which means that it will be set to Any.
- The output instance contains three fields:
βinputsβ whose value is a sub-dictionary of the input instance, consisting of all the fields listed in Arg βinputsβ. βoutputsβ β for the fields listed in Arg βoutputsβ. βmetricsβ β to contain the value of Arg βmetricsβ
Explanation about ShuffleΒΆ
Shuffles the order of instances in each page of a stream.
- Args (of superclass):
page_size (int): The size of each page in the stream. Defaults to 1000.
Explanation about ApplyΒΆ
A class used to apply a python function and store the result in a field.
- Args:
function (str): name of function. to_field (str): the field to store the result additional arguments are field names passed to the function
Examples: Store in field βbβ the uppercase string of the value in field βaβ Apply(βaβ, function=str.upper, to_field=βbβ)
Dump the json representation of field βtβ and store back in the same field. Apply(βtβ, function=json.dumps, to_field=βtβ)
Set the time in a field βbβ. Apply(function=time.time, to_field=βbβ)
References: processors.take_first_non_empty_line, processors.lower_case, metrics.accuracy
Read more about catalog usage here.