TrainableAligner#

class montreal_forced_aligner.acoustic_modeling.trainer.TrainableAligner(training_configuration=None, phone_set_type=None, **kwargs)[source]#

Bases: TranscriberMixin, TopLevelMfaWorker, ModelExporterMixin

Train acoustic model

Parameters:
  • training_configuration (list[tuple[str, dict[str, Any]]]) – Training identifiers and parameters for training blocks

  • phone_set_type (str) – Type of phone set to use for acoustic modeling

See also

CorpusAligner

For dictionary and corpus parsing parameters and alignment parameters

TopLevelMfaWorker

For top-level parameters

ModelExporterMixin

For model export parameters

Variables:
  • param_dict (dict[str, Any]) – Parameters to pass to training blocks

  • final_identifier (str) – Identifier of the final training block

  • current_subset (int) – Current training block’s subset

  • current_acoustic_model (AcousticModel) – Acoustic model to use in aligning, based on previous training block

  • training_configs (dict[str, AcousticModelTrainingMixin]) – Training blocks

add_config(train_type, params)[source]#

Add a trainer to the pipeline

Parameters:
  • train_type (str) – Type of trainer to add, one of monophone, triphone, lda or sat

  • params (dict[str, Any]) – Parameters to initialize trainer

Raises:

ConfigError – If an invalid train_type is specified

align()[source]#

Multiprocessing function that aligns based on the current model.

See also

AlignFunction

Multiprocessing helper function for each job

AlignMixin.align_arguments

Job method for generating arguments for the helper function

align_si.sh

Reference Kaldi script

align_fmllr.sh

Reference Kaldi script

property align_options#

Alignment options

property alignment_model_path#

Current alignment model path

compute_phone_pdf_counts()[source]#

Calculate the counts of pdfs corresponding to phones

property configuration#

Configuration for the worker

property data_directory#

Current data directory based on the trainer’s subset

classmethod default_training_configurations()[source]#

Default MFA training configuration

export_files(output_directory, output_format=None, include_original_text=False)[source]#

Export a TextGrid file for every sound file in the dataset

Parameters:
  • output_directory (Path) – Directory to save to

  • output_format (str, optional) – Format to save alignments, one of ‘long_textgrids’ (the default), ‘short_textgrids’, or ‘json’, passed to praatio

  • include_original_text (bool) – Flag for including the original text of the corpus files as a tier

export_model(output_model_path)[source]#

Export an acoustic model to the specified path

Parameters:

output_model_path (str) – Path to save acoustic model

property meta#

Metadata about the final round of training

property model_path#

Current model path

property num_current_utterances#

Number of utterances in the current subset

classmethod parse_parameters(config_path=None, args=None, unknown_args=None)[source]#

Parse configuration parameters from a config file and command line arguments

Parameters:
  • config_path (Path, optional) – Path to yaml configuration file

  • args (dict[str, Any]) – Parsed arguments

  • unknown_args (list[str]) – Optional list of arguments that were not parsed

Returns:

Dictionary of specified configuration parameters

Return type:

dict[str, Any]

setup()[source]#

Setup for acoustic model training

train()[source]#

Run through the training configurations to produce a final acoustic model

transition_acc_arguments()[source]#

Generate Job arguments for TransitionAccArguments

Returns:

Arguments for processing

Return type:

list[TransitionAccArguments]

property working_directory#

Working directory

property working_log_directory#

Current log directory