unitxt.task module¶
- class unitxt.task.Task(__tags__: ~typing.Dict[str, str] = {}, data_classification_policy: ~typing.List[str] = None, caching: bool = None, apply_to_streams: ~typing.List[str] = None, dont_apply_to_streams: ~typing.List[str] = None, input_fields: ~typing.Dict[str, ~typing.Any] | ~typing.Dict[str, str] | ~typing.List[str] | None = None, reference_fields: ~typing.Dict[str, ~typing.Any] | ~typing.Dict[str, str] | ~typing.List[str] | None = None, inputs: ~typing.Dict[str, ~typing.Any] | ~typing.Dict[str, str] | ~typing.List[str] = None, outputs: ~typing.Dict[str, ~typing.Any] | ~typing.Dict[str, str] | ~typing.List[str] = None, metrics: ~typing.List[str], prediction_type: ~typing.Any | str | None = None, augmentable_inputs: ~typing.List[str] = [], defaults: ~typing.Dict[str, ~typing.Any] | None = None)¶
Bases:
InstanceOperator
Task packs the different instance fields into dictionaries by their roles in the task.
- input_fields¶
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]]
- reference_fields¶
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]
- defaults¶
An optional dictionary with default values for chosen input/output keys. Needs to be consistent with names and types provided in ‘input_fields’ and/or ‘output_fields’ arguments. Will not overwrite values if already provided in a given instance.
- Type:
Optional[Dict[str, Any]]
- The output instance contains three fields:
“input_fields” whose value is a sub-dictionary of the input instance, consisting of all the fields listed in Arg ‘input_fields’. “reference_fields” – for the fields listed in Arg “reference_fields”. “metrics” – to contain the value of Arg ‘metrics’
- augmentable_inputs: List[str] = []¶
- unitxt.task.parse_string_types_instead_of_actual_objects(obj)¶