montreal_forced_aligner/ivector/trainer.py
def acc_ivector_stats_func(
    log_path: str,
    dictionaries: List[str],
    feature_strings: Dict[str, str],
    ivector_options: MetaDict,
    ie_path: str,
    post_paths: Dict[str, str],
    acc_init_paths: Dict[str, str],
) -> None:
    """
    Multiprocessing function that accumulates stats for ivector training.

    See Also
    --------
    :meth:`.IvectorTrainer.acc_ivector_stats`
        Main function that calls this function in parallel
    :meth:`.IvectorTrainer.acc_ivector_stats_arguments`
        Job method for generating arguments for this function
    :kaldi_src:`subsample-feats`
        Relevant Kaldi binary
    :kaldi_src:`ivector-extractor-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
    ivector_options: dict[str, Any]
        Options for ivector extractor training
    ie_path: str
        Path to the ivector extractor file
    post_paths: dict[str, str]
        Dictionary of posterior archives per dictionary name
    acc_init_paths: dict[str, str]
        Dictionary of accumulated stats files per dictionary name
    """
    with open(log_path, "w", encoding="utf8") as log_file:
        for dict_name in dictionaries:
            feature_string = feature_strings[dict_name]
            post_path = post_paths[dict_name]
            acc_init_path = acc_init_paths[dict_name]
            subsample_feats_proc = subprocess.Popen(
                [
                    thirdparty_binary("subsample-feats"),
                    f"--n={ivector_options['subsample']}",
                    feature_string,
                    "ark:-",
                ],
                stdout=subprocess.PIPE,
                stderr=log_file,
                env=os.environ,
            )
            acc_stats_proc = subprocess.Popen(
                [
                    thirdparty_binary("ivector-extractor-acc-stats"),
                    "--num-threads=1",
                    ie_path,
                    "ark:-",
                    f"ark:{post_path}",
                    acc_init_path,
                ],
                stdin=subsample_feats_proc.stdout,
                stderr=log_file,
                env=os.environ,
            )
            acc_stats_proc.communicate()

    Multiprocessing function that accumulates stats for ivector training.

    See Also
    --------
    :meth:`.IvectorTrainer.acc_ivector_stats`
        Main function that calls this function in parallel
    :meth:`.IvectorTrainer.acc_ivector_stats_arguments`
        Job method for generating arguments for this function
    :kaldi_src:`subsample-feats`
        Relevant Kaldi binary
    :kaldi_src:`ivector-extractor-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
    ivector_options: dict[str, Any]
        Options for ivector extractor training
    ie_path: str
        Path to the ivector extractor file
    post_paths: dict[str, str]
        Dictionary of posterior archives per dictionary name
    acc_init_paths: dict[str, str]
        Dictionary of accumulated stats files per dictionary name
    
Multiprocessing function that accumulates stats for ivector training.
See Also
Multiprocessing function that accumulates stats for ivector training . See Also
def acc_ivector_stats_func(
    log_path: str,
    dictionaries: List[str],
    feature_strings: Dict[str, str],
    ivector_options: MetaDict,
    ie_path: str,
    post_paths: Dict[str, str],
    acc_init_paths: Dict[str, str],
) -> None:
    with open(log_path, "w", encoding="utf8") as log_file:
        for dict_name in dictionaries:
            feature_string = feature_strings[dict_name]
            post_path = post_paths[dict_name]
            acc_init_path = acc_init_paths[dict_name]
            subsample_feats_proc = subprocess.Popen(
                [
                    thirdparty_binary("subsample-feats"),
                    f"--n={ivector_options['subsample']}",
                    feature_string,
                    "ark:-",
                ],
                stdout=subprocess.PIPE,
                stderr=log_file,
                env=os.environ,
            )
            acc_stats_proc = subprocess.Popen(
                [
                    thirdparty_binary("ivector-extractor-acc-stats"),
                    "--num-threads=1",
                    ie_path,
                    "ark:-",
                    f"ark:{post_path}",
                    acc_init_path,
                ],
                stdin=subsample_feats_proc.stdout,
                stderr=log_file,
                env=os.environ,
            )
            acc_stats_proc.communicate()
def acc_ivector_stats_func ( log_path : str , dictionaries : List [ str ] , feature_strings : Dict [ str , str ] , ivector_options : MetaDict , ie_path : str , post_paths : Dict [ str , str ] , acc_init_paths : Dict [ str , str ] , ) -> None : with open ( log_path , "w" , encoding = "utf8" ) as log_file : for dict_name in dictionaries : feature_string = feature_strings [ dict_name ] post_path = post_paths [ dict_name ] acc_init_path = acc_init_paths [ dict_name ] subsample_feats_proc = subprocess . Popen ( [ thirdparty_binary ( "subsample-feats" ) , f"--n={ivector_options['subsample']}" , feature_string , "ark:-" , ] , stdout = subprocess . PIPE , stderr = log_file , env = os . environ , ) acc_stats_proc = subprocess . Popen ( [ thirdparty_binary ( "ivector-extractor-acc-stats" ) , "--num-threads=1" , ie_path , "ark:-" , f"ark:{post_path}" , acc_init_path , ] , stdin = subsample_feats_proc . stdout , stderr = log_file , env = os . environ , ) acc_stats_proc . communicate ( )
Multiprocessing function that accumulates stats for ivector training.
Multiprocessing function that accumulates stats for ivector training .
"""
    Multiprocessing function that accumulates stats for ivector training.

    See Also
    --------
    :meth:`.IvectorTrainer.acc_ivector_stats`
        Main function that calls this function in parallel
    :meth:`.IvectorTrainer.acc_ivector_stats_arguments`
        Job method for generating arguments for this function
    :kaldi_src:`subsample-feats`
        Relevant Kaldi binary
    :kaldi_src:`ivector-extractor-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
    ivector_options: dict[str, Any]
        Options for ivector extractor training
    ie_path: str
        Path to the ivector extractor file
    post_paths: dict[str, str]
        Dictionary of posterior archives per dictionary name
    acc_init_paths: dict[str, str]
        Dictionary of accumulated stats files per dictionary name
    """
log_path
str
dictionaries
List[str]
feature_strings
Dict[str, str]
ivector_options
MetaDict
ie_path
str
post_paths
Dict[str, str]
acc_init_paths
Dict[str, str]
meth
`.IvectorTrainer.acc_ivector_stats`
Main function that calls this function in parallel
` . IvectorTrainer . acc_ivector_stats ` Main function that calls this function in parallel
meth
`.IvectorTrainer.acc_ivector_stats_arguments`
Job method for generating arguments for this function
` . IvectorTrainer . acc_ivector_stats_arguments ` Job method for generating arguments for this function
kaldi_src
`subsample-feats`
Relevant Kaldi binary
` subsample - feats ` Relevant Kaldi binary
kaldi_src
`ivector-extractor-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
ivector_options: dict[str, Any]
Options for ivector extractor training
ie_path: str
Path to the ivector extractor file
post_paths: dict[str, str]
Dictionary of posterior archives per dictionary name
acc_init_paths: dict[str, str]
Dictionary of accumulated stats files per dictionary name
` ivector - extractor - 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 ivector_options : dict [ str Any ] Options for ivector extractor training ie_path : str Path to the ivector extractor file post_paths : dict [ str str ] Dictionary of posterior archives per dictionary name acc_init_paths : dict [ str str ] Dictionary of accumulated stats files per dictionary name