unitxt.task module

class unitxt.task.FormTask(__tags__: ~typing.Dict[str, str] = {}, caching: bool = None, apply_to_streams: ~typing.List[str] = None, dont_apply_to_streams: ~typing.List[str] = None, inputs: ~typing.Dict[str, str] | ~typing.List[str], outputs: ~typing.Dict[str, str] | ~typing.List[str], metrics: ~typing.List[str], prediction_type: str | None = None, augmentable_inputs: ~typing.List[str] = [])

Bases: Tasker, StreamInstanceOperator

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

inputs

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.

Type:

Union[Dict[str, str], List[str]]

outputs

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.

Type:

Union[Dict[str, str], List[str]]

metrics

List of names of metrics to be used in the task.

Type:

List[str]

prediction_type

Need to be consistent with all used metrics. Defaults to None, which means that it will be set to Any.

Type:

Optional[str]

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’

augmentable_inputs: List[str] = []
class unitxt.task.MultipleChoiceTask(__tags__: ~typing.Dict[str, str] = {}, caching: bool = None, apply_to_streams: ~typing.List[str] = None, dont_apply_to_streams: ~typing.List[str] = None, inputs: ~typing.Dict[str, str] | ~typing.List[str], outputs: ~typing.Dict[str, str] | ~typing.List[str], metrics: ~typing.List[str], prediction_type: str | None = None, augmentable_inputs: ~typing.List[str] = [], choices_field: str = 'choices', choices_separator: str = '\n', enumeration_suffix: str = '. ', use_text_in_target: bool = False, alphabet: str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')

Bases: FormTask

class unitxt.task.Tasker

Bases: object