游雁
2024-06-11 d43f77408b8f3e169c59dfb6b6d82e45e6b91714
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
 
 
ckpt_id="model.pt.ep0.90000"
device="cuda:0"
 
ckpt_id=$1
device=$2
 
ckpt_dir="/nfs/beinian.lzr/workspace/GPT-4o/Exp/exp6/5m-8gpu/exp6_speech2text_linear_ddp_0609"
jsonl_dir="/nfs/beinian.lzr/workspace/GPT-4o/Data/Speech2Text/TestData"
 
out_dir="${ckpt_dir}/inference-${ckpt_id}"
mkdir -p ${out_dir}
for data_set in "librispeech_test_clean_speech2text.jsonl" "librispeech_test_other_speech2text.jsonl"; do
{
    jsonl=${jsonl_dir}/${data_set}
    output_dir=${out_dir}/${data_set}
    mkdir -p ${output_dir}
    pred_file=${output_dir}/1best_recog/text_tn
    ref_file=${output_dir}/1best_recog/label
 
    python ./demo_speech2text.py ${ckpt_dir} ${ckpt_id} ${jsonl} ${output_dir} ${device}
 
    python /mnt/workspace/zhifu.gzf/codebase/FunASR/funasr/metrics/wer.py ++ref_file=${ref_file} ++hyp_file=${pred_file} ++cer_file=${pred_file}.cer ++cn_postprocess=false
 
}&
done
wait
 
for data_set in "aishell1_test_speech2text.jsonl" "aishell2_ios_test_speech2text.jsonl"; do
{
    jsonl=${jsonl_dir}/${data_set}
    output_dir=${out_dir}/${data_set}
    mkdir -p ${output_dir}
    pred_file=${output_dir}/1best_recog/text_tn
    ref_file=${output_dir}/1best_recog/label
 
    python ./demo_speech2text.py ${ckpt_dir} ${ckpt_id} ${jsonl} ${output_dir} ${device}
 
    python /mnt/workspace/zhifu.gzf/codebase/FunASR/funasr/metrics/wer.py ++ref_file=${ref_file} ++hyp_file=${pred_file} ++cer_file=${pred_file}.cer ++cn_postprocess=true
 
}&
done
wait
 
for data_set in "common_voice_zh-CN_speech2text.jsonl" "common_voice_en_speech2text.jsonl"; do
{
    jsonl=${jsonl_dir}/${data_set}
    output_dir=${out_dir}/${data_set}
    mkdir -p ${output_dir}
    pred_file=${output_dir}/1best_recog/text_tn
    ref_file=${output_dir}/1best_recog/label
 
    python ./demo_speech2text.py ${ckpt_dir} ${ckpt_id} ${jsonl} ${output_dir} ${device}
 
    cn_postprocess=false
    if [ $data_set = "common_voice_zh-CN_speech2text.jsonl" ];then
      cn_postprocess=true
    fi
 
    python /mnt/workspace/zhifu.gzf/codebase/FunASR/funasr/metrics/wer.py ++ref_file=${ref_file} ++hyp_file=${pred_file} ++cer_file=${pred_file}.cer ++cn_postprocess=${cn_postprocess}
 
}&
done
wait