Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,19 @@

from loguru import logger

from nemo_curator.stages.audio._agent._agent_ready import AgentReady, Gates, StageContract
from nemo_curator.stages.audio.filtering import BandFilterStage, SIGMOSFilterStage, UTMOSFilterStage
from nemo_curator.stages.audio.postprocessing import TimestampMapperStage
from nemo_curator.stages.audio.preprocessing import MonoConversionStage, SegmentConcatenationStage
from nemo_curator.stages.audio.segmentation import SpeakerSeparationStage, VADSegmentationStage
from nemo_curator.stages.base import CompositeStage, ProcessingStage
from nemo_curator.stages.resources import Resources
from nemo_curator.tasks import AudioTask

from .config import _deep_merge, get_enabled_stages, load_config


class AudioDataFilterStage(CompositeStage):
class AudioDataFilterStage(AgentReady, CompositeStage[AudioTask, AudioTask]):
"""Complete audio data filtering and curation pipeline (CompositeStage).

Decomposes into independent stages that the executor can schedule with
Expand Down Expand Up @@ -90,6 +92,16 @@ def __init__(
if config:
self._cfg = _deep_merge(self._cfg, config)

def describe(self) -> StageContract:
return StageContract(
wrappable=False,
# True for every topology because it is true of each delegate: mono conversion, VAD,
# the three quality filters, concatenation, speaker separation and the timestamp
# mapper all work from the row they are handed. The factories below leave
# ``write_to_disk`` unset throughout, so none of them even opens a shared directory.
gates=Gates(per_row_independent=True),
)

def decompose(self) -> list[ProcessingStage]:
"""Build a self-consistent pipeline topology based on enabled features."""
cfg = self._cfg
Expand Down
Loading