nemo_curator.stages.function_decorators
nemo_curator.stages.function_decorators
Utility decorators for creating ProcessingStage instances from simple functions.
This module provides a :func:processing_stage decorator that turns a plain
Python function into a concrete :class:nemo_curator.stages.base.ProcessingStage.
Example
The variable word_count now holds an instance of a concrete
ProcessingStage subclass that can be added directly to a
:class:nemo_curator.pipeline.Pipeline like so:
Module Contents
Functions
Data
API
Decorator that converts a function into a :class:ProcessingStage.
Parameters
name:
The name assigned to the resulting stage (ProcessingStage.name).
resources:
Optional :class:nemo_curator.stages.resources.Resources
or dict[str, float] describing the required compute resources.
If None a default of Resources() is used.
batch_size:
Optional batch size for the stage. None means no explicit batch
size (executor decides).
The decorated function must:
- Accept exactly one positional argument: a :class:
Taskinstance (or subclass). - Return either a single :class:
Taskinstance or alistof tasks.