Pipeline API

Public API for the training pipeline driver.

class pstrain.api.pipeline.PipelineContext(project_dir, experiment='default', config_name='default', feat=<factory>, train=<factory>, split=<factory>, runner=<factory>, sharding=<factory>, description='', resolved_config=None)[source]

Bases: object

Per-run configuration for the training pipeline.

Parameters:
  • project_dir (Path)

  • experiment (str)

  • config_name (str)

  • feat (FeatParams)

  • train (TrainParams)

  • split (SplitParams)

  • runner (RunnerParams)

  • sharding (ShardingParams)

  • description (str)

  • resolved_config (ResolvedConfig | None)

__init__(project_dir, experiment='default', config_name='default', feat=<factory>, train=<factory>, split=<factory>, runner=<factory>, sharding=<factory>, description='', resolved_config=None)
Parameters:
  • project_dir (Path)

  • experiment (str)

  • config_name (str)

  • feat (FeatParams)

  • train (TrainParams)

  • split (SplitParams)

  • runner (RunnerParams)

  • sharding (ShardingParams)

  • description (str)

  • resolved_config (ResolvedConfig | None)

Return type:

None

all_fileids()[source]

Train + test fileids (post-split). Use audio_fileids() if you need the full corpus before split has run.

Return type:

list[str]

property all_transcription: Path

Master (pre-split) transcription, input to the split task.

property architecture_dir: Path
property audio_dir: Path
audio_fileids(extension='.wav')[source]

All audio fileids, recursively derived from audio/**/*<ext>.

Returns sorted POSIX-style paths relative to the audio directory, without the extension. This is the canonical set of files that feature extraction operates on and is independent of whether the train/test split has run yet.

Parameters:

extension (str)

Return type:

list[str]

config_name: str = 'default'
description: str = ''
property dist_dir: Path
property etc_dir: Path
experiment: str = 'default'
property experiment_dir: Path
feat: FeatParams
property features_dir: Path
property filler_dict: Path | None

Optional filler dictionary; None if not present.

property filler_dict_path: Path

Stable optional dependency path, including when the file is absent.

fingerprint_payload(stage)[source]

Return the explicitly declared resolved values and identity keys.

Parameters:

stage (str)

Return type:

dict[str, Any]

classmethod from_config(project_dir, *, experiment='default', config_name='default', cli_overrides=None)[source]

Build a context by reading project/etc/configs.yaml.

Parameters:
Return type:

Self

property lm_dir: Path
model_dir(target)[source]

Directory for an acoustic model output, e.g. cd-8g.

Parameters:

target (str)

Return type:

Path

model_files(target)[source]

Standard set of files that constitute a trained model directory.

Parameters:

target (str)

Return type:

list[Path]

property models_dir: Path
project_dir: Path
provenance_document(stage)[source]

Serializable provenance, including its effective-config fingerprint.

Parameters:

stage (str)

Return type:

dict[str, Any]

provenance_path(stage)[source]

Content-addressed path for a stage’s effective configuration.

Parameters:

stage (str)

Return type:

Path

provenance_payload(stage)[source]

Canonical effective configuration governing a pipeline stage.

Parameters:

stage (str)

Return type:

dict[str, Any]

read_fileids(split)[source]

Read a fileid list (e.g. ‘train’, ‘test’, ‘dev’).

Returns an empty list if the file doesn’t exist (planning before corpus setup is allowed; tasks that need fileids will fail at run time with a clearer message).

Parameters:

split (str)

Return type:

list[str]

property reports_dir: Path
resolved_config: ResolvedConfig | None = None
runner: RunnerParams
sharding: ShardingParams
property shared_dir: Path
split: SplitParams
train: TrainParams
property trees_dir: Path
validate_training_features()[source]

Reject unsupported native BW front ends before building dependencies.

Return type:

None

exception pstrain.api.pipeline.UnknownTargetError[source]

Bases: KeyError

Raised when a build target is not registered with the pipeline.

pstrain.api.pipeline.build_pipeline(ctx)[source]

Build a pipeline with all pstrain training tasks registered for ctx.

Feature-extraction tasks are expanded to one task per audio file found recursively under the audio directory. An empty or missing audio directory fails immediately during pipeline construction.

Parameters:

ctx (PipelineContext)

Return type:

Pipeline

pstrain.api.pipeline.create_pipeline_context(project_dir, *, experiment='default', config_name='default', cli_overrides=None)[source]

Build a context by reading project/etc/configs.yaml.

PipelineContext is re-exported unchanged, so the public name and the library name are the same class. This factory gives the command line a public-API call frame without altering that class.

Parameters:
Return type:

PipelineContext

pstrain.api.pipeline.run_pipeline(pipeline, target, *, dry_run=False, force=False, jobs=None, verbose=False)[source]

Run a training graph through a concrete public-API call frame.

Parameters:
Return type:

int

pstrain.api.pipeline.TARGETS

Registered pipeline targets.

pstrain.api.pipeline.DEFAULT_TARGET

Default target selected for a pipeline build.

pstrain.api.pipeline.DEFAULT_CONFIGS

Names of the bundled pipeline configurations.