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

        See Also
        --------
        :func:`~montreal_forced_aligner.ivector.trainer.acc_ivector_stats_func`
            Multiprocessing helper function for each job
        :meth:`.IvectorTrainer.acc_ivector_stats_arguments`
            Job method for generating arguments for the helper function
        :kaldi_src:`ivector-extractor-sum-accs`
            Relevant Kaldi binary
        :kaldi_src:`ivector-extractor-est`
            Relevant Kaldi binary
        :kaldi_steps_sid:`train_ivector_extractor`
            Reference Kaldi script
        """

        jobs = self.acc_ivector_stats_arguments()
        if self.use_mp:
            run_mp(acc_ivector_stats_func, jobs, self.working_log_directory)
        else:
            run_non_mp(acc_ivector_stats_func, jobs, self.working_log_directory)

        log_path = os.path.join(self.working_log_directory, f"sum_acc.{self.iteration}.log")
        acc_path = os.path.join(self.working_directory, f"acc.{self.iteration}")
        with open(log_path, "w", encoding="utf8") as log_file:
            accinits = []
            for j in jobs:
                accinits.extend(j.acc_init_paths.values())
            sum_accs_proc = subprocess.Popen(
                [thirdparty_binary("ivector-extractor-sum-accs"), "--parallel=true"]
                + accinits
                + [acc_path],
                stderr=log_file,
                env=os.environ,
            )

            sum_accs_proc.communicate()
        # clean up
        for p in accinits:
            os.remove(p)
        # Est extractor
        log_path = os.path.join(self.working_log_directory, f"update.{self.iteration}.log")
        with open(log_path, "w") as log_file:
            extractor_est_proc = subprocess.Popen(
                [
                    thirdparty_binary("ivector-extractor-est"),
                    f"--num-threads={len(self.jobs)}",
                    f"--gaussian-min-count={self.gaussian_min_count}",
                    self.ie_path,
                    os.path.join(self.working_directory, f"acc.{self.iteration}"),
                    self.next_ie_path,
                ],
                stderr=log_file,
                env=os.environ,
            )
            extractor_est_proc.communicate()

        Multiprocessing function that accumulates ivector extraction stats.

        See Also
        --------
        :func:`~montreal_forced_aligner.ivector.trainer.acc_ivector_stats_func`
            Multiprocessing helper function for each job
        :meth:`.IvectorTrainer.acc_ivector_stats_arguments`
            Job method for generating arguments for the helper function
        :kaldi_src:`ivector-extractor-sum-accs`
            Relevant Kaldi binary
        :kaldi_src:`ivector-extractor-est`
            Relevant Kaldi binary
        :kaldi_steps_sid:`train_ivector_extractor`
            Reference Kaldi script
        
Multiprocessing function that accumulates ivector extraction stats.
See Also
Multiprocessing function that accumulates ivector extraction stats . See Also
def acc_ivector_stats(self) -> None:
        jobs = self.acc_ivector_stats_arguments()
        if self.use_mp:
            run_mp(acc_ivector_stats_func, jobs, self.working_log_directory)
        else:
            run_non_mp(acc_ivector_stats_func, jobs, self.working_log_directory)
        log_path = os.path.join(self.working_log_directory, f"sum_acc.{self.iteration}.log")
        acc_path = os.path.join(self.working_directory, f"acc.{self.iteration}")
        with open(log_path, "w", encoding="utf8") as log_file:
            accinits = []
            for j in jobs:
                accinits.extend(j.acc_init_paths.values())
            sum_accs_proc = subprocess.Popen(
                [thirdparty_binary("ivector-extractor-sum-accs"), "--parallel=true"]
                + accinits
                + [acc_path],
                stderr=log_file,
                env=os.environ,
            )
            sum_accs_proc.communicate()
        for p in accinits:
            os.remove(p)
        log_path = os.path.join(self.working_log_directory, f"update.{self.iteration}.log")
        with open(log_path, "w") as log_file:
            extractor_est_proc = subprocess.Popen(
                [
                    thirdparty_binary("ivector-extractor-est"),
                    f"--num-threads={len(self.jobs)}",
                    f"--gaussian-min-count={self.gaussian_min_count}",
                    self.ie_path,
                    os.path.join(self.working_directory, f"acc.{self.iteration}"),
                    self.next_ie_path,
                ],
                stderr=log_file,
                env=os.environ,
            )
            extractor_est_proc.communicate()
def acc_ivector_stats ( self ) -> None : jobs = self . acc_ivector_stats_arguments ( ) if self . use_mp : run_mp ( acc_ivector_stats_func , jobs , self . working_log_directory ) else : run_non_mp ( acc_ivector_stats_func , jobs , self . working_log_directory ) log_path = os . path . join ( self . working_log_directory , f"sum_acc.{self.iteration}.log" ) acc_path = os . path . join ( self . working_directory , f"acc.{self.iteration}" ) with open ( log_path , "w" , encoding = "utf8" ) as log_file : accinits = [ ] for j in jobs : accinits . extend ( j . acc_init_paths . values ( ) ) sum_accs_proc = subprocess . Popen ( [ thirdparty_binary ( "ivector-extractor-sum-accs" ) , "--parallel=true" ] + accinits + [ acc_path ] , stderr = log_file , env = os . environ , ) sum_accs_proc . communicate ( ) for p in accinits : os . remove ( p ) log_path = os . path . join ( self . working_log_directory , f"update.{self.iteration}.log" ) with open ( log_path , "w" ) as log_file : extractor_est_proc = subprocess . Popen ( [ thirdparty_binary ( "ivector-extractor-est" ) , f"--num-threads={len(self.jobs)}" , f"--gaussian-min-count={self.gaussian_min_count}" , self . ie_path , os . path . join ( self . working_directory , f"acc.{self.iteration}" ) , self . next_ie_path , ] , stderr = log_file , env = os . environ , ) extractor_est_proc . communicate ( )
Multiprocessing function that accumulates ivector extraction stats.
Multiprocessing function that accumulates ivector extraction stats .
"""
        Multiprocessing function that accumulates ivector extraction stats.

        See Also
        --------
        :func:`~montreal_forced_aligner.ivector.trainer.acc_ivector_stats_func`
            Multiprocessing helper function for each job
        :meth:`.IvectorTrainer.acc_ivector_stats_arguments`
            Job method for generating arguments for the helper function
        :kaldi_src:`ivector-extractor-sum-accs`
            Relevant Kaldi binary
        :kaldi_src:`ivector-extractor-est`
            Relevant Kaldi binary
        :kaldi_steps_sid:`train_ivector_extractor`
            Reference Kaldi script
        """ # clean up # Est extractor
self
func
`~montreal_forced_aligner.ivector.trainer.acc_ivector_stats_func`
Multiprocessing helper function for each job
` ~montreal_forced_aligner . ivector . trainer . acc_ivector_stats_func ` Multiprocessing helper function for each job
meth
`.IvectorTrainer.acc_ivector_stats_arguments`
Job method for generating arguments for the helper function
` . IvectorTrainer . acc_ivector_stats_arguments ` Job method for generating arguments for the helper function
kaldi_src
`ivector-extractor-sum-accs`
Relevant Kaldi binary
` ivector - extractor - sum - accs ` Relevant Kaldi binary
kaldi_src
`ivector-extractor-est`
Relevant Kaldi binary
` ivector - extractor - est ` Relevant Kaldi binary
kaldi_steps_sid
`train_ivector_extractor`
Reference Kaldi script
` train_ivector_extractor ` Reference Kaldi script