Esempio n. 1
0
def main(cmd=None):
    """LM training.

    Example:

        % python lm_train.py asr --print_config --optim adadelta
        % python lm_train.py --config conf/train_asr.yaml
    """
    LMTask.main(cmd=cmd)
Esempio n. 2
0
def lm_config_file(tmp_path: Path, token_list):
    # Write default configuration file
    LMTask.main(cmd=[
        "--dry_run",
        "true",
        "--output_dir",
        str(tmp_path / "lm"),
        "--token_list",
        str(token_list),
        "--token_type",
        "char",
    ])
    return tmp_path / "lm" / "config.yaml"
Esempio n. 3
0
def lm_config_file(tmp_path: Path, token_list):
    lm_conf = "{'nlayers': 1, 'unit': 8}"

    LMTask.main(
        cmd=[
            "--dry_run",
            "true",
            "--output_dir",
            str(tmp_path / "lm"),
            "--token_list",
            str(token_list),
            "--token_type",
            "char",
            "--lm_conf",
            lm_conf,
        ]
    )
    return tmp_path / "lm" / "config.yaml"
Esempio n. 4
0
def test_main_with_no_args():
    with pytest.raises(SystemExit):
        LMTask.main(cmd=[])
Esempio n. 5
0
def test_main_print_config():
    with pytest.raises(SystemExit):
        LMTask.main(cmd=["--print_config"])
Esempio n. 6
0
def test_main_help():
    with pytest.raises(SystemExit):
        LMTask.main(cmd=["--help"])