Tasks
Modules:
| Name | Description | 
|---|---|
task_preprocessor | 
            
               | 
          
Classes:
| Name | Description | 
|---|---|
DefaultTaskPreprocessor | 
            
               Default task preprocessor that returns the input dataset unchanged.  | 
          
TaskPreprocessingFunction | 
            
               A protocol for a function that preprocesses datasets.  | 
          
TaskPreprocessor | 
            
               A class preprocessing a dataset for a specific task.  | 
          
DefaultTaskPreprocessor
              Bases: TaskPreprocessor
Default task preprocessor that returns the input dataset unchanged.
Methods:
| Name | Description | 
|---|---|
__call__ | 
              
                 Preprocesses the input dataset for a specific task.  | 
            
__init__ | 
              
                 Initializes the default task preprocessor.  | 
            
Source code in evalsense/tasks/task_preprocessor.py
                __call__
__call__(
    hf_dataset: Dataset,
    dataset_manager: DatasetManager,
    field_spec: FieldSpec | RecordToSample | None = None,
    force_reprocess: bool = False,
) -> Dataset
Preprocesses the input dataset for a specific task.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                hf_dataset
             | 
            
                  Dataset
             | 
            
               The input dataset to preprocess, in HuggingFace format.  | 
            required | 
                dataset_manager
             | 
            
                  DatasetManager
             | 
            
               The dataset manager used to retrieve the dataset.  | 
            required | 
                field_spec
             | 
            
                  FieldSpec
             | 
            
               Specification mapping dataset fields to sample fields. See Inspect AI documentation for more details.  | 
            
                  None
             | 
          
                force_reprocess
             | 
            
                  bool
             | 
            
               Whether to force reprocess the dataset even if it already exists. Defaults to False.  | 
            
                  False
             | 
          
Returns:
| Type | Description | 
|---|---|
                  Dataset
             | 
            
               The preprocessed dataset.  | 
          
Source code in evalsense/tasks/task_preprocessor.py
              __init__
Initializes the default task preprocessor.
TaskPreprocessingFunction
              Bases: Protocol
A protocol for a function that preprocesses datasets.
You can pass this function to a TaskPreprocessor to perform some task-specific preprocessing on a dataset. This is especially useful in cases in which a single dataset can be used for multiple different tasks, with each requiring different preprocessing steps.
Methods:
| Name | Description | 
|---|---|
__call__ | 
              
                 Preprocesses the input dataset for a specific task.  | 
            
Source code in evalsense/tasks/task_preprocessor.py
                __call__
Preprocesses the input dataset for a specific task.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                hf_dataset
             | 
            
                  Dataset
             | 
            
               The input dataset to preprocess, in HuggingFace format.  | 
            required | 
                dataset_manager
             | 
            
                  DatasetManager
             | 
            
               The dataset manager used to retrieve the dataset.  | 
            required | 
Returns:
| Type | Description | 
|---|---|
                  Dataset
             | 
            
               The preprocessed dataset.  | 
          
Source code in evalsense/tasks/task_preprocessor.py
              TaskPreprocessor
A class preprocessing a dataset for a specific task.
Methods:
| Name | Description | 
|---|---|
__call__ | 
              
                 Preprocesses the input dataset for a specific task.  | 
            
__init__ | 
              
                 Initializes the task preprocessor.  | 
            
Source code in evalsense/tasks/task_preprocessor.py
                __call__
__call__(
    hf_dataset: Dataset,
    dataset_manager: DatasetManager,
    field_spec: FieldSpec | RecordToSample | None = None,
    force_reprocess: bool = False,
) -> Dataset
Preprocesses the input dataset for a specific task.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                hf_dataset
             | 
            
                  Dataset
             | 
            
               The input dataset to preprocess, in HuggingFace format.  | 
            required | 
                dataset_manager
             | 
            
                  DatasetManager
             | 
            
               The dataset manager used to retrieve the dataset.  | 
            required | 
                field_spec
             | 
            
                  FieldSpec
             | 
            
               Specification mapping dataset fields to sample fields. See Inspect AI documentation for more details.  | 
            
                  None
             | 
          
                force_reprocess
             | 
            
                  bool
             | 
            
               Whether to force reprocess the dataset even if it already exists. Defaults to False.  | 
            
                  False
             | 
          
Returns:
| Type | Description | 
|---|---|
                  Dataset
             | 
            
               The preprocessed dataset.  | 
          
Source code in evalsense/tasks/task_preprocessor.py
              __init__
Initializes the task preprocessor.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                name
             | 
            
                  str
             | 
            
               The name of the task preprocessor.  | 
            required | 
                preprocessing_function
             | 
            
                  TaskPreprocessingFunction
             | 
            
               The function used to preprocess the dataset.  | 
            required |