예제 #1
0
def main(cmd=None):
    r"""ASR training.

    Example:

        % python asr_train.py asr --print_config --optim adadelta \
                > conf/train_asr.yaml
        % python asr_train.py --config conf/train_asr.yaml
    """
    ASRTask.main(cmd=cmd)
예제 #2
0
def asr_config_file(tmp_path: Path, token_list):
    # Write default configuration file
    ASRTask.main(cmd=[
        "--dry_run",
        "true",
        "--output_dir",
        str(tmp_path / "asr"),
        "--token_list",
        str(token_list),
        "--token_type",
        "char",
    ])
    return tmp_path / "asr" / "config.yaml"
예제 #3
0
def asr_config_file_streaming(tmp_path: Path, token_list):
    # Write default configuration file
    ASRTask.main(cmd=[
        "--dry_run",
        "true",
        "--output_dir",
        str(tmp_path / "asr_streaming"),
        "--token_list",
        str(token_list),
        "--token_type",
        "char",
        "--decoder",
        "transformer",
        "--encoder",
        "contextual_block_transformer",
    ])
    return tmp_path / "asr_streaming" / "config.yaml"
예제 #4
0
def test_main_with_no_args():
    with pytest.raises(SystemExit):
        ASRTask.main(cmd=[])
예제 #5
0
def test_main_print_config():
    with pytest.raises(SystemExit):
        ASRTask.main(cmd=["--print_config"])
예제 #6
0
def test_main_help():
    with pytest.raises(SystemExit):
        ASRTask.main(cmd=["--help"])