Skip to content

Commit 9937302

Browse files
committed
download automatically allignments
1 parent fefdcfb commit 9937302

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

recipes/LJSpeech/TTS/ljspeech_prepare.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import torchaudio
1616
import numpy as np
1717
from tqdm import tqdm
18+
from speechbrain.utils.data_utils import download_file
1819
from speechbrain.dataio.dataio import load_pkl, save_pkl
1920
import tgt
2021
from speechbrain.pretrained import GraphemeToPhoneme
@@ -125,10 +126,17 @@ def prepare_ljspeech(
125126
# Setting up additional folders required for FastSpeech2
126127
if model_name == "FastSpeech2":
127128
# This step requires phoneme alignements to be present in the data_folder
129+
# We automatically donwload the alignments from https://www.dropbox.com/s/v28x5ldqqa288pu/LJSpeech.zip
128130
# Download and unzip LJSpeech phoneme alignments from here: https://drive.google.com/drive/folders/1DBRkALpPd6FL9gjHMmMEdHODmkgNIIK4
131+
alignment_URL = (
132+
"https://www.dropbox.com/s/v28x5ldqqa288pu/LJSpeech.zip?dl=1"
133+
)
129134
phoneme_alignments_folder = os.path.join(
130135
data_folder, "TextGrid", "LJSpeech"
131136
)
137+
download_file(
138+
alignment_URL, data_folder + "/alligments.zip", unpack=True
139+
)
132140

133141
duration_folder = os.path.join(data_folder, "durations")
134142
if not os.path.exists(duration_folder):
@@ -557,7 +565,6 @@ def get_alignment(tier, sampling_rate, hop_length, last_phoneme_flags):
557565

558566

559567
def get_last_phoneme_info(words_seq, phones_seq):
560-
561568
"""This function takes word and phoneme tiers from a TextGrid file as input
562569
and provides a list of tuples for the phoneme sequence indicating whether
563570
each of the phonemes is the last phoneme of a word or not.

0 commit comments

Comments
 (0)