def run_asr(asr_dir, split, w2v_ckpt, w2v_label, res_dir):
    """
    results will be saved at
    {res_dir}/{ref,hypo}.word-{w2v_ckpt.filename}-{split}.txt
    """
    cmd = ["python", "-m", "examples.speech_recognition.infer"]
    cmd += [str(asr_dir.resolve())]
    cmd += ["--task", "audio_finetuning", "--nbest", "1", "--quiet"]
    cmd += ["--w2l-decoder", "viterbi", "--criterion", "ctc"]
    cmd += ["--post-process", "letter", "--max-tokens", "4000000"]
    cmd += ["--path", str(w2v_ckpt.resolve()), "--labels", w2v_label]
    cmd += ["--gen-subset", split, "--results-path", str(res_dir.resolve())]

    print(f"running cmd:\n{' '.join(cmd)}")
    subprocess.run(cmd, check=True)

    results will be saved at
    {res_dir}/{ref,hypo}.word-{w2v_ckpt.filename}-{split}.txt
    
understand_icl/fairseq/examples/speech_synthesis/evaluation/eval_asr.py