run_data.sh 1.1 KB
Newer Older
1
#! /usr/bin/env bash
2

Y
Yibing Liu 已提交
3
cd ../.. > /dev/null
4

X
Xinghai Sun 已提交
5 6 7 8 9 10
# prepare folder
if [ ! -e data/tiny ]; then
    mkdir data/tiny
fi


11
# download data, generate manifests
Y
Yibing Liu 已提交
12
PYTHONPATH=.:$PYTHONPATH python data/librispeech/librispeech.py \
13
--manifest_prefix='data/tiny/manifest' \
14 15
--target_dir='~/.cache/paddle/dataset/speech/libri' \
--full_download='False'
16 17 18 19 20 21

if [ $? -ne 0 ]; then
    echo "Prepare LibriSpeech failed. Terminated."
    exit 1
fi

22
head -n 64 data/tiny/manifest.dev-clean  > data/tiny/manifest.tiny
23 24 25 26 27 28


# build vocabulary
python tools/build_vocab.py \
--count_threshold=0 \
--vocab_path='data/tiny/vocab.txt' \
Y
Yibing Liu 已提交
29
--manifest_paths='data/tiny/manifest.dev-clean'
30 31 32 33 34 35 36 37 38

if [ $? -ne 0 ]; then
    echo "Build vocabulary failed. Terminated."
    exit 1
fi


# compute mean and stddev for normalizer
python tools/compute_mean_std.py \
39 40
--manifest_path='data/tiny/manifest.tiny' \
--num_samples=64 \
41 42 43 44 45 46 47 48 49 50
--specgram_type='linear' \
--output_path='data/tiny/mean_std.npz'

if [ $? -ne 0 ]; then
    echo "Compute mean and stddev failed. Terminated."
    exit 1
fi


echo "Tiny data preparation done."
51
exit 0