mirror of https://github.com/coqui-ai/TTS.git
Change config to json 3
This commit is contained in:
parent
e225993fb6
commit
1ee45b5336
|
@ -25,5 +25,5 @@
|
||||||
"text_cleaner": "english_cleaners",
|
"text_cleaner": "english_cleaners",
|
||||||
|
|
||||||
"data_path": "/data/shared/KeithIto/LJSpeech-1.0",
|
"data_path": "/data/shared/KeithIto/LJSpeech-1.0",
|
||||||
"output_path": "./result"
|
"output_path": "result"
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
|
@ -4,7 +4,6 @@ import numpy as np
|
||||||
import collections
|
import collections
|
||||||
from torch.utils.data import Dataset
|
from torch.utils.data import Dataset
|
||||||
|
|
||||||
import train_config as c
|
|
||||||
from Tacotron.utils.text import text_to_sequence
|
from Tacotron.utils.text import text_to_sequence
|
||||||
from Tacotron.utils.audio import *
|
from Tacotron.utils.audio import *
|
||||||
from Tacotron.utils.data import prepare_data, pad_data, pad_per_step
|
from Tacotron.utils.data import prepare_data, pad_data, pad_per_step
|
||||||
|
@ -12,16 +11,19 @@ from Tacotron.utils.data import prepare_data, pad_data, pad_per_step
|
||||||
|
|
||||||
class LJSpeechDataset(Dataset):
|
class LJSpeechDataset(Dataset):
|
||||||
|
|
||||||
def __init__(self, csv_file, root_dir, outputs_per_step):
|
def __init__(self, csv_file, root_dir, outputs_per_step, sample_rate,
|
||||||
|
cleaners):
|
||||||
self.frames = pd.read_csv(csv_file, sep='|', header=None)
|
self.frames = pd.read_csv(csv_file, sep='|', header=None)
|
||||||
self.root_dir = root_dir
|
self.root_dir = root_dir
|
||||||
self.outputs_per_step = outputs_per_step
|
self.outputs_per_step = outputs_per_step
|
||||||
|
self.sample_rate = sample_rate
|
||||||
|
self.cleaners = cleaners
|
||||||
print(" > Reading LJSpeech from - {}".format(root_dir))
|
print(" > Reading LJSpeech from - {}".format(root_dir))
|
||||||
print(" | > Number of instances : {}".format(len(self.frames)))
|
print(" | > Number of instances : {}".format(len(self.frames)))
|
||||||
|
|
||||||
def load_wav(self, filename):
|
def load_wav(self, filename):
|
||||||
try:
|
try:
|
||||||
audio = librosa.load(filename, sr=c.sample_rate)
|
audio = librosa.load(filename, sr=self.sample_rate)
|
||||||
return audio
|
return audio
|
||||||
except RuntimeError as e:
|
except RuntimeError as e:
|
||||||
print(" !! Cannot read file : {}".format(filename))
|
print(" !! Cannot read file : {}".format(filename))
|
||||||
|
@ -33,7 +35,7 @@ class LJSpeechDataset(Dataset):
|
||||||
wav_name = os.path.join(self.root_dir,
|
wav_name = os.path.join(self.root_dir,
|
||||||
self.frames.ix[idx, 0]) + '.wav'
|
self.frames.ix[idx, 0]) + '.wav'
|
||||||
text = self.frames.ix[idx, 1]
|
text = self.frames.ix[idx, 1]
|
||||||
text = np.asarray(text_to_sequence(text, [c.cleaners]), dtype=np.int32)
|
text = np.asarray(text_to_sequence(text, [self.cleaners]), dtype=np.int32)
|
||||||
wav = np.asarray(self.load_wav(wav_name)[0], dtype=np.float32)
|
wav = np.asarray(self.load_wav(wav_name)[0], dtype=np.float32)
|
||||||
sample = {'text': text, 'wav': wav}
|
sample = {'text': text, 'wav': wav}
|
||||||
return sample
|
return sample
|
||||||
|
|
4
train.py
4
train.py
|
@ -42,7 +42,9 @@ def main(args):
|
||||||
|
|
||||||
dataset = LJSpeechDataset(os.path.join(c.data_path, 'metadata.csv'),
|
dataset = LJSpeechDataset(os.path.join(c.data_path, 'metadata.csv'),
|
||||||
os.path.join(c.data_path, 'wavs'),
|
os.path.join(c.data_path, 'wavs'),
|
||||||
c.r
|
c.r,
|
||||||
|
c.sample_rate,
|
||||||
|
c.text_cleaner
|
||||||
)
|
)
|
||||||
|
|
||||||
model = Tacotron(c.embedding_size,
|
model = Tacotron(c.embedding_size,
|
||||||
|
|
Binary file not shown.
|
@ -1,8 +1,6 @@
|
||||||
import librosa
|
import librosa
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy import signal
|
from scipy import signal
|
||||||
import Tacotron.train_config as c
|
|
||||||
|
|
||||||
|
|
||||||
_mel_basis = None
|
_mel_basis = None
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ def remove_experiment_folder(experiment_path):
|
||||||
"""Check folder if there is a checkpoint, otherwise remove the folder"""
|
"""Check folder if there is a checkpoint, otherwise remove the folder"""
|
||||||
|
|
||||||
checkpoint_files = glob.glob(experiment_path+"/*.pth.tar")
|
checkpoint_files = glob.glob(experiment_path+"/*.pth.tar")
|
||||||
if len(checkpoint_files) < 2:
|
if len(checkpoint_files) < 1:
|
||||||
shutil.rmtree(experiment_path)
|
shutil.rmtree(experiment_path)
|
||||||
print(" ! Run is removed from {}".format(experiment_path))
|
print(" ! Run is removed from {}".format(experiment_path))
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue