montreal_forced_aligner/ivector/trainer.py
def gmm_gselect_func(
    log_path: str,
    dictionaries: List[str],
    feature_strings: Dict[str, str],
    dubm_options: MetaDict,
    dubm_path: str,
    gselect_paths: Dict[str, str],
) -> None:
    """
    Multiprocessing function for selecting GMM indices.

    See Also
    --------
    :meth:`.DubmTrainer.gmm_gselect`
        Main function that calls this function in parallel
    :meth:`.DubmTrainer.gmm_gselect_arguments`
        Job method for generating arguments for this function
    :kaldi_src:`subsample-feats`
        Relevant Kaldi binary
    :kaldi_src:`gmm-gselect`
        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
    dubm_path: str
        Path to the DUBM file
    gselect_paths: dict[str, str]
        Dictionary of gselect archives per dictionary name
    """
    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]
            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,
            )

            gselect_proc = subprocess.Popen(
                [
                    thirdparty_binary("gmm-gselect"),
                    f"--n={dubm_options['num_gselect']}",
                    dubm_path,
                    "ark:-",
                    f"ark:{gselect_path}",
                ],
                stdin=subsample_feats_proc.stdout,
                stderr=log_file,
                env=os.environ,
            )
            gselect_proc.communicate()

    Multiprocessing function for selecting GMM indices.

    See Also
    --------
    :meth:`.DubmTrainer.gmm_gselect`
        Main function that calls this function in parallel
    :meth:`.DubmTrainer.gmm_gselect_arguments`
        Job method for generating arguments for this function
    :kaldi_src:`subsample-feats`
        Relevant Kaldi binary
    :kaldi_src:`gmm-gselect`
        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
    dubm_path: str
        Path to the DUBM file
    gselect_paths: dict[str, str]
        Dictionary of gselect archives per dictionary name
    
Multiprocessing function for selecting GMM indices.
See Also
Multiprocessing function for selecting GMM indices . See Also
def gmm_gselect_func(
    log_path: str,
    dictionaries: List[str],
    feature_strings: Dict[str, str],
    dubm_options: MetaDict,
    dubm_path: str,
    gselect_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]
            gselect_path = gselect_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,
            )
            gselect_proc = subprocess.Popen(
                [
                    thirdparty_binary("gmm-gselect"),
                    f"--n={dubm_options['num_gselect']}",
                    dubm_path,
                    "ark:-",
                    f"ark:{gselect_path}",
                ],
                stdin=subsample_feats_proc.stdout,
                stderr=log_file,
                env=os.environ,
            )
            gselect_proc.communicate()
def gmm_gselect_func ( log_path : str , dictionaries : List [ str ] , feature_strings : Dict [ str , str ] , dubm_options : MetaDict , dubm_path : str , gselect_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 ] gselect_path = gselect_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 , ) gselect_proc = subprocess . Popen ( [ thirdparty_binary ( "gmm-gselect" ) , f"--n={dubm_options['num_gselect']}" , dubm_path , "ark:-" , f"ark:{gselect_path}" , ] , stdin = subsample_feats_proc . stdout , stderr = log_file , env = os . environ , ) gselect_proc . communicate ( )
Multiprocessing function for selecting GMM indices.
Multiprocessing function for selecting GMM indices .
"""
    Multiprocessing function for selecting GMM indices.

    See Also
    --------
    :meth:`.DubmTrainer.gmm_gselect`
        Main function that calls this function in parallel
    :meth:`.DubmTrainer.gmm_gselect_arguments`
        Job method for generating arguments for this function
    :kaldi_src:`subsample-feats`
        Relevant Kaldi binary
    :kaldi_src:`gmm-gselect`
        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
    dubm_path: str
        Path to the DUBM file
    gselect_paths: dict[str, str]
        Dictionary of gselect archives per dictionary name
    """
log_path
str
dictionaries
List[str]
feature_strings
Dict[str, str]
dubm_options
MetaDict
dubm_path
str
gselect_paths
Dict[str, str]
meth
`.DubmTrainer.gmm_gselect`
Main function that calls this function in parallel
` . DubmTrainer . gmm_gselect ` Main function that calls this function in parallel
meth
`.DubmTrainer.gmm_gselect_arguments`
Job method for generating arguments for this function
` . DubmTrainer . gmm_gselect_arguments ` Job method for generating arguments for this function
kaldi_src
`subsample-feats`
Relevant Kaldi binary
` subsample - feats ` Relevant Kaldi binary
kaldi_src
`gmm-gselect`
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
dubm_path: str
Path to the DUBM file
gselect_paths: dict[str, str]
Dictionary of gselect archives per dictionary name
` gmm - gselect ` 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 dubm_path : str Path to the DUBM file gselect_paths : dict [ str str ] Dictionary of gselect archives per dictionary name