πŸ“„ 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 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 FormTaskΒΆ

FormTask packs the different instance fields into dictionaries by their roles in the task.

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 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: metrics.accuracy, processors.lower_case, processors.take_first_non_empty_line

Read more about catalog usage here.