コード例 #1
0
ファイル: lm_train.py プロジェクト: sw005320/espnet-1
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)
コード例 #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"
コード例 #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"
コード例 #4
0
ファイル: test_lm.py プロジェクト: sw005320/espnet-1
def test_main_with_no_args():
    with pytest.raises(SystemExit):
        LMTask.main(cmd=[])
コード例 #5
0
ファイル: test_lm.py プロジェクト: sw005320/espnet-1
def test_main_print_config():
    with pytest.raises(SystemExit):
        LMTask.main(cmd=["--print_config"])
コード例 #6
0
ファイル: test_lm.py プロジェクト: sw005320/espnet-1
def test_main_help():
    with pytest.raises(SystemExit):
        LMTask.main(cmd=["--help"])