AcousticModelTrainingMixin#

class montreal_forced_aligner.acoustic_modeling.base.AcousticModelTrainingMixin(identifier, worker, num_iterations=40, subset=0, max_gaussians=1000, boost_silence=1.25, power=0.25, initial_gaussians=0, optional=False, **kwargs)[source]#

Bases: AlignMixin, TrainerMixin, FeatureConfigMixin, MfaWorker, ModelExporterMixin

Base trainer class for training acoustic models and ivector extractors

Parameters:
  • identifier (str) – Identifier for the trainer

  • worker (AcousticCorpusPronunciationMixin) – Top-level worker

  • num_iterations (int) – Number of iterations, defaults to 40

  • subset (int) – Number of utterances to use, defaults to 0 which will use the whole corpus

  • max_gaussians (int) – Total number of gaussians, defaults to 1000

  • boost_silence (float) – Factor by which to boost silence during alignment, defaults to 1.25

  • power (float) – Exponent for number of gaussians according to occurrence counts, defaults to 0.25

  • initial_gaussians (int) – Initial number of gaussians, defaults to 0

See also

AlignMixin

For alignment parameters

TrainerMixin

For training parameters

FeatureConfigMixin

For feature generation parameters

MfaWorker

For MFA processing parameters

ModelExporterMixin

For model export parameters

Variables:

realignment_iterations (list) – Iterations to perform alignment

acc_stats()[source]#

Multiprocessing function that accumulates stats for GMM training.

See also

AccStatsFunction

Multiprocessing helper function for each job

AcousticModelTrainingMixin.acc_stats_arguments

Job method for generating arguments for the helper function

gmmbin/gmm-sum-accs.cc

Relevant Kaldi binary

gmmbin/gmm-est.cc

Relevant Kaldi binary

train_mono.sh

Reference Kaldi script

train_deltas.sh

Reference Kaldi script

acc_stats_arguments()[source]#

Generate Job arguments for AccStatsFunction

Returns:

Arguments for processing

Return type:

list[AccStatsArguments]

acoustic_model_training_params()[source]#

Configuration parameters

align_iteration()[source]#

Run alignment for a training iteration

property alignment_model_path#

Alignment model path

abstract compute_calculated_properties()[source]#

Compute any calculated properties such as alignment iterations

property corpus_output_directory#

Directory of the corpus

property data_directory#

Get the current data directory based on subset

property db_engine#

Top-level worker’s database engine

property db_string#

Root worker’s database connection string

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 exported_model_path#

Model path to export to once training is complete

finalize_training()[source]#

Finalize the training, renaming all final iteration model files as “final”, and exporting the model to be used in the next round alignment

property gaussian_increment#

Amount by which gaussians should be increased each iteration

increment_gaussians()[source]#

Increment the current number of gaussians

initialize_training()[source]#

Initialize training

property jobs#

Top-level worker’s job objects

property meta#

Generate metadata for the acoustic model that was trained

property model_path#

Current acoustic model path

property next_model_path#

Next iteration’s acoustic model path

property num_current_utterances#

Number of utterances of the corpus

property phone_type#

Phone type, not implemented for BaseTrainer

property previous_aligner#

Previous aligner seeding training

session(**kwargs)[source]#

Top-level worker’s database session

train()[source]#

Train the model

Raises:

KaldiProcessingError – If there were any errors in running Kaldi binaries

train_iteration()[source]#

Perform an iteration of training

property train_type#

Training type, not implemented for BaseTrainer

utterances(session=None)[source]#

Get all utterances in the trainer’s root worker

Parameters:

session (sqlalchemy.orm.Session, optional) – Session to use in querying

Returns:

Utterance query

Return type:

sqlalchemy.orm.Query

property working_directory#

Training directory

property working_log_directory#

Training log directory