CLI API
Command-line interface.
JSON output
--json produces a single machine-readable result on standard output for:
checkpointsvalidate-projecttestinfotraintutorialconfig explainconfig profilesconfig showconfig getconfig schemaconfig list
The formatting controls --json-indent and --json-ascii apply to these
commands. Human-readable progress that accompanies a JSON result is written to
standard error.
The following commands do not yet have a stable machine-readable result
contract and reject --json with a nonzero exit status instead of silently
producing human output. Unsupported JSON requests exit with status
64; parser usage errors retain status 2.
The rejecting commands are:
setupbuildsplitfeaturesflatcleanpackagealigncomparetimingsconfig migrateconfig pathstep ci_hmmstep cd_hmm_untied
Place the global flag before the command name when checking support. Commands that support JSON also advertise it in their command help.
Command-line interface for pstrain.
The CLI provides commands for the complete acoustic model training workflow:
- pstrain setup - Initialize a new project
- pstrain validate-project - Validate project structure
- pstrain split - Split data into train/test sets
- pstrain features - Extract acoustic features
- pstrain flat - Initialize flat HMM models
- pstrain build - Build a model target (e.g. ci-1g, cd-8g)
- pstrain package - Package a trained model for distribution
- pstrain clean - Clean training outputs
- pstrain config - Manage configuration
- pstrain step - Run numbered training steps
All commands support --dry-run to preview actions without execution.
- class pstrain.cli.Command[source]
Bases:
ABCBase class for CLI commands.
- abstractmethod add_arguments(parser)[source]
Add command-specific arguments.
- Parameters:
parser (ArgumentParser)
- Return type:
None
- abstractmethod execute(ctx)[source]
Execute the command.
- Parameters:
ctx (CommandContext)
- Return type:
- class pstrain.cli.CommandContext(args, dry_run=False, verbose=False, json_output=False, json_indent=2, json_ascii=False, _header_emitted=False)[source]
Bases:
objectContext passed to command execution.
Provides unified methods that either emit shell or execute directly.
- Parameters:
- __init__(args, dry_run=False, verbose=False, json_output=False, json_indent=2, json_ascii=False, _header_emitted=False)
- baum_welch(mdef, mean, var, mixw, tmat, ctl, cepdir, dictfn, lsnfn=None, accumdir=None, cepext='.mfc')[source]
Run Baum-Welch training.
- build_tree(moddeffn, meanfn, varfn, mixwfn, psetfn, treefn, phone, state)[source]
Build decision tree.
- comment(text)[source]
Add a comment (no-op when executing).
- Parameters:
text (str)
- Return type:
None
- emit_json(data, output_path=None)[source]
Serialize JSON once and emit identical bytes to its destinations.
- extract_features(input_file, output_file, samprate=16000, nfilt=25, ncep=13)[source]
Extract features from audio file.
- split_gaussians(inmeanfn, invarfn, inmixwfn, outmeanfn, outvarfn, outmixwfn)[source]
Split Gaussian components.
- class pstrain.cli.CommandResult(success, message='', data=<factory>, exit_code=0)[source]
Bases:
objectResult of command execution.
- __init__(success, message='', data=<factory>, exit_code=0)
- class pstrain.cli.ModelCommand[source]
Bases:
ProjectCommandCommand that operates on models within a project.
- add_model_arguments(parser)[source]
Add common model arguments.
- Parameters:
parser (ArgumentParser)
- Return type:
None
- get_model(ctx)[source]
Create model instance from args.
- Parameters:
ctx (CommandContext)
- Return type: