espnet3.utils.stages_utils.run_stages
Less than 1 minute
espnet3.utils.stages_utils.run_stages
espnet3.utils.stages_utils.run_stages(system: Any, stages_to_run: Iterable[str], args: Namespace | None = None, log: Logger | None = None) → None
Invoke stage methods on system in order with logging and timing.
- Parameters:
- system – Object providing stage methods named in
stages_to_run. - stages_to_run – Iterable of stage method names to execute.
- args – Parsed CLI arguments.
dry_runandwrite_requirementsare read from here when present. - log – Optional logger instance; defaults to module logger.
- system – Object providing stage methods named in
- Raises:
- AttributeError – If a named stage method is missing on
system. - TypeError – If a stage method rejects CLI-provided arguments.
- Exception – Re-raises any exception from a stage method.
- AttributeError – If a named stage method is missing on
Examples
>>> from espnet3.contract.stages import StageSpec
>>> class ExampleSystem:
... stages = (StageSpec(name="train", config="training"),)
... _default_log_dir = None
... def train(self):
... print("training ran")
>>> run_stages(ExampleSystem(), ["train"])
training ran