File size: 1,053 Bytes
62e9ca6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#####################################
# Fast Text2Unit Model #
#####################################
[ $# -lt 2 ] && echo "Usage: $0 <model_path> <gen_set> " && exit 0
[ ${PWD##*/} != SpeechLM ] && echo "Error: dir not match! Switch to SpeechLM/ and run it again!" && exit 1

model_path=$1
src_dir=${model_path%/*}
cpt=${model_path##*/}
cpt=${cpt%.*}

gen_set=$2

DATA_DIR=${gen_set%/*}
gen_set=${gen_set##*/}
outdir=$src_dir/decode_${cpt}

CODE_ROOT=${PWD}

for subset in ${gen_set//,/ }; do
    results_path=$outdir/phone2unit_${subset}
    [ ! -d $results_path ] && mkdir -p $results_path

    python $CODE_ROOT/speechlm/generate_unit.py $DATA_DIR \
    --user-dir $CODE_ROOT/speechlm \
    --config-yaml config.yaml \
    --path ${model_path} \
    --task fast_text_to_unit \
    --gen-subset $subset \
    \
    --beam 1 \
    --max-tokens 10000 \
    --results-path $results_path \
    --scoring sacrebleu

    echo $results_path
    tail -n 1 $results_path/generate-*.txt
    sleep 1s
done

# --distributed-world-size 1000 --distributed-rank 0 \