One-command Training API

Public API for one-command training utilities.

exception pstrain.api.one_command.PromptFormatError[source]

Bases: ValueError

A prompt file is malformed or its format cannot be detected safely.

pstrain.api.one_command.identity_difference(expected, actual, prefix='')[source]

Return the first stable, human-readable identity difference.

Parameters:
Return type:

str | None

pstrain.api.one_command.input_identity(audio_dir, prompts_path, dictionary_path, filler_path, phoneset_path, link_audio=False)[source]
Parameters:
  • audio_dir (Path)

  • prompts_path (Path)

  • dictionary_path (Path)

  • filler_path (Path | None)

  • phoneset_path (Path | None)

  • link_audio (bool)

Return type:

dict[str, object]

pstrain.api.one_command.installed_corpus_identity(project_dir, *, audio_ownership)[source]

Hash exactly the installed corpus consumed by training.

Parameters:
  • project_dir (Path)

  • audio_ownership (str)

Return type:

dict[str, object]

pstrain.api.one_command.validate_inputs(audio_dir, prompts_path, dictionary_path, prompt_format, phoneset_path=None, filler_path=None)[source]

Fully validate corpus inputs before project setup or training.

Parameters:
  • audio_dir (Path)

  • prompts_path (Path)

  • dictionary_path (Path)

  • prompt_format (str)

  • phoneset_path (Path | None)

  • filler_path (Path | None)

Return type:

tuple[InputReport, list[Prompt]]

pstrain.api.one_command.write_training_transcription(path, prompts)[source]
Parameters:
Return type:

None

pstrain.api.one_command.write_validation_reports(project_dir, report)[source]
Parameters:
  • project_dir (Path)

  • report (InputReport)

Return type:

tuple[Path, Path]

pstrain.api.one_command.PROMPT_FORMATS

Supported input formats for training prompts.