diff --git a/parakeet/data/batch.py b/parakeet/data/batch.py index 515074d1..5e7ac399 100644 --- a/parakeet/data/batch.py +++ b/parakeet/data/batch.py @@ -53,8 +53,8 @@ def batch_text_id(minibatch, pad_id=0, dtype=np.int64): peek_example = minibatch[0] assert len(peek_example.shape) == 1, "text example is an 1D tensor" - lengths = [example.shape[0] for example in minibatch - ] # assume (channel, n_samples) or (n_samples, ) + lengths = [example.shape[0] for example in + minibatch] # assume (channel, n_samples) or (n_samples, ) max_len = np.max(lengths) batch = [] diff --git a/parakeet/exps/tacotron2/ljspeech.py b/parakeet/exps/tacotron2/ljspeech.py index 20dc29d3..59c855eb 100644 --- a/parakeet/exps/tacotron2/ljspeech.py +++ b/parakeet/exps/tacotron2/ljspeech.py @@ -67,19 +67,16 @@ class LJSpeechCollector(object): # Sort by text_len in descending order texts = [ - i - for i, _ in sorted( + i for i, _ in sorted( zip(texts, text_lens), key=lambda x: x[1], reverse=True) ] mels = [ - i - for i, _ in sorted( + i for i, _ in sorted( zip(mels, text_lens), key=lambda x: x[1], reverse=True) ] mel_lens = [ - i - for i, _ in sorted( + i for i, _ in sorted( zip(mel_lens, text_lens), key=lambda x: x[1], reverse=True) ] diff --git a/tools/Makefile b/tools/Makefile index 87107a53..e2aba8fe 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -24,7 +24,7 @@ clean: apt.done: apt update -y - apt install -y bc flac jq vim tig tree pkg-config libflac-dev libogg-dev libvorbis-dev libboost-dev swig python3-dev + apt install -y bc flac jq vim tig tree pkg-config libsndfile1 libflac-dev libogg-dev libvorbis-dev libboost-dev swig python3-dev echo "check_certificate = off" >> ~/.wgetrc touch apt.done diff --git a/tools/extras/README.md b/tools/extras/README.md index 19c06a13..7d03c4be 100644 --- a/tools/extras/README.md +++ b/tools/extras/README.md @@ -1,3 +1,7 @@ +# install scripts +call from `tools` dir. + +## Details 1. kaldi deps gcc, mkl or openblas diff --git a/tools/extras/install_soundfile.sh b/tools/extras/install_soundfile.sh new file mode 100755 index 00000000..cbc4e00d --- /dev/null +++ b/tools/extras/install_soundfile.sh @@ -0,0 +1,18 @@ +# install package libsndfile + +WGET=wget --no-check-certificate + +SOUNDFILE=libsndfile-1.0.28 +SOUNDFILE_LIB=${SOUNDFILE}tar.gz + +echo "Install package libsndfile into default system path." +test -e ${SOUNDFILE_LIB} || ${WGET} -c "http://www.mega-nerd.com/libsndfile/files/${SOUNDFILE_LIB}" +if [ $? != 0 ]; then + echo "Download ${SOUNDFILE_LIB} failed !!!" + exit 1 +fi + +tar -zxvf ${SOUNDFILE_LIB} +pushd ${SOUNDFILE} +./configure > /dev/null && make > /dev/null && make install > /dev/null +popd \ No newline at end of file