montreal_forced_aligner/ivector/trainer.py
def acc_global_stats_func(
    log_path: str,
    dictionaries: List[str],
    feature_strings: Dict[str, str],
    dubm_options: MetaDict,
    gselect_paths: Dict[str, str],
    acc_paths: Dict[str, str],
    dubm_path: str,
) -> None:
    """
    Multiprocessing function for accumulating global model stats.

    See Also
    --------
    :meth:`.DubmTrainer.acc_global_stats`
        Main function that calls this function in parallel
    :meth:`.DubmTrainer.acc_global_stats_arguments`
        Job method for generating arguments for this function
    :kaldi_src:`subsample-feats`
        Relevant Kaldi binary
    :kaldi_src:`gmm-global-acc-stats`
        Relevant Kaldi binary

    Parameters
    ----------
    log_path: str
        Path to save log output
    dictionaries: list[str]
        List of dictionary names
    feature_strings: dict[str, str]
        Dictionary of feature strings per dictionary name
    dubm_options: dict[str, Any]
        Options for DUBM training
    gselect_paths: dict[str, str]
        Dictionary of gselect archives per dictionary name
    acc_paths: dict[str, str]
        Dictionary of accumulated stats files per dictionary name
    dubm_path: str
        Path to the DUBM file
    """
    with open(log_path, "w", encoding="utf8") as log_file:
        for dict_name in dictionaries:
            feature_string = feature_strings[dict_name]
            gselect_path = gselect_paths[dict_name]
            acc_path = acc_paths[dict_name]
            subsample_feats_proc = subprocess.Popen(
                [
                    thirdparty_binary("subsample-feats"),
                    f"--n={dubm_options['subsample']}",
                    feature_string,
                    "ark:-",
                ],
                stdout=subprocess.PIPE,
                stderr=log_file,
                env=os.environ,
            )
            gmm_global_acc_proc = subprocess.Popen(
                [
                    thirdparty_binary("gmm-global-acc-stats"),
                    f"--gselect=ark:{gselect_path}",
                    dubm_path,
                    "ark:-",
                    acc_path,
                ],
                stderr=log_file,
                stdin=subsample_feats_proc.stdout,
                env=os.environ,
            )
            gmm_global_acc_proc.communicate()

    Multiprocessing function for accumulating global model stats.

    See Also
    --------
    :meth:`.DubmTrainer.acc_global_stats`
        Main function that calls this function in parallel
    :meth:`.DubmTrainer.acc_global_stats_arguments`
        Job method for generating arguments for this function
    :kaldi_src:`subsample-feats`
        Relevant Kaldi binary
    :kaldi_src:`gmm-global-acc-stats`
        Relevant Kaldi binary

    Parameters
    ----------
    log_path: str
        Path to save log output
    dictionaries: list[str]
        List of dictionary names
    feature_strings: dict[str, str]
        Dictionary of feature strings per dictionary name
    dubm_options: dict[str, Any]
        Options for DUBM training
    gselect_paths: dict[str, str]
        Dictionary of gselect archives per dictionary name
    acc_paths: dict[str, str]
        Dictionary of accumulated stats files per dictionary name
    dubm_path: str
        Path to the DUBM file
    
Multiprocessing function for accumulating global model stats.
See Also
Multiprocessing function for accumulating global model stats . See Also
def acc_global_stats_func(
    log_path: str,
    dictionaries: List[str],
    feature_strings: Dict[str, str],
    dubm_options: MetaDict,
    gselect_paths: Dict[str, str],
    acc_paths: Dict[str, str],
    dubm_path: str,
) -> None:
    with open(log_path, "w", encoding="utf8") as log_file:
        for dict_name in dictionaries:
            feature_string = feature_strings[dict_name]
            gselect_path = gselect_paths[dict_name]
            acc_path = acc_paths[dict_name]
            subsample_feats_proc = subprocess.Popen(
                [
                    thirdparty_binary("subsample-feats"),
                    f"--n={dubm_options['subsample']}",
                    feature_string,
                    "ark:-",
                ],
                stdout=subprocess.PIPE,
                stderr=log_file,
                env=os.environ,
            )
            gmm_global_acc_proc = subprocess.Popen(
                [
                    thirdparty_binary("gmm-global-acc-stats"),
                    f"--gselect=ark:{gselect_path}",
                    dubm_path,
                    "ark:-",
                    acc_path,
                ],
                stderr=log_file,
                stdin=subsample_feats_proc.stdout,
                env=os.environ,
            )
            gmm_global_acc_proc.communicate()
def acc_global_stats_func ( log_path : str , dictionaries : List [ str ] , feature_strings : Dict [ str , str ] , dubm_options : MetaDict , gselect_paths : Dict [ str , str ] , acc_paths : Dict [ str , str ] , dubm_path : str , ) -> None : with open ( log_path , "w" , encoding = "utf8" ) as log_file : for dict_name in dictionaries : feature_string = feature_strings [ dict_name ] gselect_path = gselect_paths [ dict_name ] acc_path = acc_paths [ dict_name ] subsample_feats_proc = subprocess . Popen ( [ thirdparty_binary ( "subsample-feats" ) , f"--n={dubm_options['subsample']}" , feature_string , "ark:-" , ] , stdout = subprocess . PIPE , stderr = log_file , env = os . environ , ) gmm_global_acc_proc = subprocess . Popen ( [ thirdparty_binary ( "gmm-global-acc-stats" ) , f"--gselect=ark:{gselect_path}" , dubm_path , "ark:-" , acc_path , ] , stderr = log_file , stdin = subsample_feats_proc . stdout , env = os . environ , ) gmm_global_acc_proc . communicate ( )
Multiprocessing function for accumulating global model stats.
Multiprocessing function for accumulating global model stats .
"""
    Multiprocessing function for accumulating global model stats.

    See Also
    --------
    :meth:`.DubmTrainer.acc_global_stats`
        Main function that calls this function in parallel
    :meth:`.DubmTrainer.acc_global_stats_arguments`
        Job method for generating arguments for this function
    :kaldi_src:`subsample-feats`
        Relevant Kaldi binary
    :kaldi_src:`gmm-global-acc-stats`
        Relevant Kaldi binary

    Parameters
    ----------
    log_path: str
        Path to save log output
    dictionaries: list[str]
        List of dictionary names
    feature_strings: dict[str, str]
        Dictionary of feature strings per dictionary name
    dubm_options: dict[str, Any]
        Options for DUBM training
    gselect_paths: dict[str, str]
        Dictionary of gselect archives per dictionary name
    acc_paths: dict[str, str]
        Dictionary of accumulated stats files per dictionary name
    dubm_path: str
        Path to the DUBM file
    """
log_path
str
dictionaries
List[str]
feature_strings
Dict[str, str]
dubm_options
MetaDict
gselect_paths
Dict[str, str]
acc_paths
Dict[str, str]
dubm_path
str
meth
`.DubmTrainer.acc_global_stats`
Main function that calls this function in parallel
` . DubmTrainer . acc_global_stats ` Main function that calls this function in parallel
meth
`.DubmTrainer.acc_global_stats_arguments`
Job method for generating arguments for this function
` . DubmTrainer . acc_global_stats_arguments ` Job method for generating arguments for this function
kaldi_src
`subsample-feats`
Relevant Kaldi binary
` subsample - feats ` Relevant Kaldi binary
kaldi_src
`gmm-global-acc-stats`
Relevant Kaldi binary

Parameters

str
Path to save log output
dictionaries: list[str]
List of dictionary names
feature_strings: dict[str, str]
Dictionary of feature strings per dictionary name
dubm_options: dict[str, Any]
Options for DUBM training
gselect_paths: dict[str, str]
Dictionary of gselect archives per dictionary name
acc_paths: dict[str, str]
Dictionary of accumulated stats files per dictionary name
dubm_path: str
Path to the DUBM file
` gmm - global - acc - stats ` Relevant Kaldi binary Parameters str Path to save log output dictionaries : list [ str ] List of dictionary names feature_strings : dict [ str str ] Dictionary of feature strings per dictionary name dubm_options : dict [ str Any ] Options for DUBM training gselect_paths : dict [ str str ] Dictionary of gselect archives per dictionary name acc_paths : dict [ str str ] Dictionary of accumulated stats files per dictionary name dubm_path : str Path to the DUBM file