montreal_forced_aligner/ivector/trainer.py
def acc_global_stats(self) -> None:
        """
        Multiprocessing function that accumulates global GMM stats

        See Also
        --------
        :func:`~montreal_forced_aligner.ivector.trainer.acc_global_stats_func`
            Multiprocessing helper function for each job
        :meth:`.DubmTrainer.acc_global_stats_arguments`
            Job method for generating arguments for the helper function
        :kaldi_src:`gmm-global-sum-accs`
            Relevant Kaldi binary
        :kaldi_steps:`train_diag_ubm`
            Reference Kaldi script

        """
        jobs = self.acc_global_stats_arguments()
        if self.use_mp:
            run_mp(acc_global_stats_func, jobs, self.working_log_directory)
        else:
            run_non_mp(acc_global_stats_func, jobs, self.working_log_directory)

        # Don't remove low-count Gaussians till the last tier,
        # or gselect info won't be valid anymore
        if self.iteration < self.num_iterations:
            opt = "--remove-low-count-gaussians=false"
        else:
            opt = f"--remove-low-count-gaussians={self.remove_low_count_gaussians}"
        log_path = os.path.join(self.working_log_directory, f"update.{self.iteration}.log")
        with open(log_path, "w") as log_file:
            acc_files = []
            for j in jobs:
                acc_files.extend(j.acc_paths.values())
            sum_proc = subprocess.Popen(
                [thirdparty_binary("gmm-global-sum-accs"), "-"] + acc_files,
                stderr=log_file,
                stdout=subprocess.PIPE,
                env=os.environ,
            )
            gmm_global_est_proc = subprocess.Popen(
                [
                    thirdparty_binary("gmm-global-est"),
                    opt,
                    f"--min-gaussian-weight={self.min_gaussian_weight}",
                    self.model_path,
                    "-",
                    self.next_model_path,
                ],
                stderr=log_file,
                stdin=sum_proc.stdout,
                env=os.environ,
            )
            gmm_global_est_proc.communicate()
            # Clean up
            if not self.debug:
                for p in acc_files:
                    os.remove(p)

        Multiprocessing function that accumulates global GMM stats

        See Also
        --------
        :func:`~montreal_forced_aligner.ivector.trainer.acc_global_stats_func`
            Multiprocessing helper function for each job
        :meth:`.DubmTrainer.acc_global_stats_arguments`
            Job method for generating arguments for the helper function
        :kaldi_src:`gmm-global-sum-accs`
            Relevant Kaldi binary
        :kaldi_steps:`train_diag_ubm`
            Reference Kaldi script

        
Multiprocessing function that accumulates global GMM stats
See Also
Multiprocessing function that accumulates global GMM stats See Also
def acc_global_stats(self) -> None:
        jobs = self.acc_global_stats_arguments()
        if self.use_mp:
            run_mp(acc_global_stats_func, jobs, self.working_log_directory)
        else:
            run_non_mp(acc_global_stats_func, jobs, self.working_log_directory)
        if self.iteration < self.num_iterations:
            opt = "--remove-low-count-gaussians=false"
        else:
            opt = f"--remove-low-count-gaussians={self.remove_low_count_gaussians}"
        log_path = os.path.join(self.working_log_directory, f"update.{self.iteration}.log")
        with open(log_path, "w") as log_file:
            acc_files = []
            for j in jobs:
                acc_files.extend(j.acc_paths.values())
            sum_proc = subprocess.Popen(
                [thirdparty_binary("gmm-global-sum-accs"), "-"] + acc_files,
                stderr=log_file,
                stdout=subprocess.PIPE,
                env=os.environ,
            )
            gmm_global_est_proc = subprocess.Popen(
                [
                    thirdparty_binary("gmm-global-est"),
                    opt,
                    f"--min-gaussian-weight={self.min_gaussian_weight}",
                    self.model_path,
                    "-",
                    self.next_model_path,
                ],
                stderr=log_file,
                stdin=sum_proc.stdout,
                env=os.environ,
            )
            gmm_global_est_proc.communicate()
            if not self.debug:
                for p in acc_files:
                    os.remove(p)
def acc_global_stats ( self ) -> None : jobs = self . acc_global_stats_arguments ( ) if self . use_mp : run_mp ( acc_global_stats_func , jobs , self . working_log_directory ) else : run_non_mp ( acc_global_stats_func , jobs , self . working_log_directory ) if self . iteration < self . num_iterations : opt = "--remove-low-count-gaussians=false" else : opt = f"--remove-low-count-gaussians={self.remove_low_count_gaussians}" log_path = os . path . join ( self . working_log_directory , f"update.{self.iteration}.log" ) with open ( log_path , "w" ) as log_file : acc_files = [ ] for j in jobs : acc_files . extend ( j . acc_paths . values ( ) ) sum_proc = subprocess . Popen ( [ thirdparty_binary ( "gmm-global-sum-accs" ) , "-" ] + acc_files , stderr = log_file , stdout = subprocess . PIPE , env = os . environ , ) gmm_global_est_proc = subprocess . Popen ( [ thirdparty_binary ( "gmm-global-est" ) , opt , f"--min-gaussian-weight={self.min_gaussian_weight}" , self . model_path , "-" , self . next_model_path , ] , stderr = log_file , stdin = sum_proc . stdout , env = os . environ , ) gmm_global_est_proc . communicate ( ) if not self . debug : for p in acc_files : os . remove ( p )
Multiprocessing function that accumulates global GMM stats
See Also
Multiprocessing function that accumulates global GMM stats See Also
"""
        Multiprocessing function that accumulates global GMM stats

        See Also
        --------
        :func:`~montreal_forced_aligner.ivector.trainer.acc_global_stats_func`
            Multiprocessing helper function for each job
        :meth:`.DubmTrainer.acc_global_stats_arguments`
            Job method for generating arguments for the helper function
        :kaldi_src:`gmm-global-sum-accs`
            Relevant Kaldi binary
        :kaldi_steps:`train_diag_ubm`
            Reference Kaldi script

        """ # Don't remove low-count Gaussians till the last tier, # or gselect info won't be valid anymore # Clean up
self
func
`~montreal_forced_aligner.ivector.trainer.acc_global_stats_func`
Multiprocessing helper function for each job
` ~montreal_forced_aligner . ivector . trainer . acc_global_stats_func ` Multiprocessing helper function for each job
meth
`.DubmTrainer.acc_global_stats_arguments`
Job method for generating arguments for the helper function
` . DubmTrainer . acc_global_stats_arguments ` Job method for generating arguments for the helper function
kaldi_src
`gmm-global-sum-accs`
Relevant Kaldi binary
` gmm - global - sum - accs ` Relevant Kaldi binary
kaldi_steps
`train_diag_ubm`
Reference Kaldi script
` train_diag_ubm ` Reference Kaldi script