mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-09-11 18:14:19 +00:00
78 lines
2.1 KiB
Bash
Executable File
78 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# fix segmentation fault reported in https://github.com/k2-fsa/icefall/issues/674
|
|
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
|
|
|
|
set -eou pipefail
|
|
|
|
nj=1
|
|
stage=-1
|
|
stop_stage=100
|
|
|
|
# dl_dir=$PWD/download
|
|
dl_dir=/star-data/zengwei/download/ljspeech/
|
|
|
|
. shared/parse_options.sh || exit 1
|
|
|
|
# All files generated by this script are saved in "data".
|
|
# You can safely remove "data" and rerun this script to regenerate it.
|
|
mkdir -p data
|
|
|
|
log() {
|
|
# This function is from espnet
|
|
local fname=${BASH_SOURCE[1]##*/}
|
|
echo -e "$(date '+%Y-%m-%d %H:%M:%S') (${fname}:${BASH_LINENO[0]}:${FUNCNAME[1]}) $*"
|
|
}
|
|
|
|
log "dl_dir: $dl_dir"
|
|
|
|
if [ $stage -le 0 ] && [ $stop_stage -ge 0 ]; then
|
|
log "Stage 0: Download data"
|
|
|
|
# If you have pre-downloaded it to /path/to/LJSpeech,
|
|
# you can create a symlink
|
|
#
|
|
# ln -sfv /path/to/LJSpeech $dl_dir/LJSpeech
|
|
#
|
|
if [ ! -d $dl_dir/LJSpeech-1.1 ]; then
|
|
lhotse download ljspeech $dl_dir
|
|
fi
|
|
fi
|
|
|
|
if [ $stage -le 1 ] && [ $stop_stage -ge 1 ]; then
|
|
log "Stage 1: Prepare LJSpeech manifest"
|
|
# We assume that you have downloaded the LJSpeech corpus
|
|
# to $dl_dir/LJSpeech
|
|
mkdir -p data/manifests
|
|
if [ ! -e data/manifests/.ljspeech.done ]; then
|
|
lhotse prepare ljspeech $dl_dir/LJSpeech-1.1 data/manifests
|
|
touch data/manifests/.ljspeech.done
|
|
fi
|
|
fi
|
|
|
|
if [ $stage -le 2 ] && [ $stop_stage -ge 2 ]; then
|
|
log "Stage 2: Compute spectrogram for LJSpeech"
|
|
mkdir -p data/spectrogram
|
|
if [ ! -e data/spectrogram/.ljspeech.done ]; then
|
|
./local/compute_spectrogram_ljspeech.py
|
|
touch data/spectrogram/.ljspeech.done
|
|
fi
|
|
|
|
if [ ! -e data/spectrogram/.ljspeech-validated.done ]; then
|
|
log "Validating data/fbank for LJSpeech"
|
|
python3 ./local/validate_manifest.py \
|
|
data/spectrogram/ljspeech_cuts_all.jsonl.gz
|
|
touch data/spectrogram/.ljspeech-validated.done
|
|
fi
|
|
fi
|
|
|
|
if [ $stage -le 3 ] && [ $stop_stage -ge 3 ]; then
|
|
log "Stage 3: Split the LJSpeech cuts into three sets"
|
|
if [ ! -e data/spectrogram/.ljspeech_split.done ]; then
|
|
./local/split_subsets.py data/spectrogram
|
|
touch data/spectrogram/.ljspeech_split.done
|
|
fi
|
|
fi
|
|
|
|
|