mirror of
https://github.com/wassname/TTS.git
synced 2026-09-09 11:16:00 +08:00
dropped dataset caching
This commit is contained in:
+8
-10
@@ -7,7 +7,7 @@ from torch.utils.data import DataLoader
|
||||
from utils.generic_utils import load_config
|
||||
from utils.audio import AudioProcessor
|
||||
from datasets import TTSDataset
|
||||
from datasets.preprocess import ljspeech, tts_cache
|
||||
from datasets.preprocess import ljspeech
|
||||
|
||||
file_path = os.path.dirname(os.path.realpath(__file__))
|
||||
OUTPATH = os.path.join(file_path, "outputs/loader_tests/")
|
||||
@@ -16,15 +16,11 @@ c = load_config(os.path.join(file_path, 'test_config.json'))
|
||||
ok_ljspeech = os.path.exists(c.data_path)
|
||||
|
||||
DATA_EXIST = True
|
||||
CACHE_EXIST = True
|
||||
if not os.path.exists(c.data_path_cache):
|
||||
CACHE_EXIST = False
|
||||
|
||||
if not os.path.exists(c.data_path):
|
||||
DATA_EXIST = False
|
||||
|
||||
print(" > Dynamic data loader test: {}".format(DATA_EXIST))
|
||||
print(" > Cache data loader test: {}".format(CACHE_EXIST))
|
||||
|
||||
|
||||
class TestTTSDataset(unittest.TestCase):
|
||||
def __init__(self, *args, **kwargs):
|
||||
@@ -126,8 +122,9 @@ class TestTTSDataset(unittest.TestCase):
|
||||
wav = self.ap.load_wav(item_idx[0])
|
||||
mel = self.ap.melspectrogram(wav)
|
||||
mel_dl = mel_input[0].cpu().numpy()
|
||||
assert (
|
||||
abs(mel.T).astype("float32") - abs(mel_dl[:-1])).sum() == 0
|
||||
assert (abs(mel.T).astype("float32")
|
||||
- abs(mel_dl[:-1])
|
||||
).sum() == 0
|
||||
|
||||
# check mel-spec correctness
|
||||
mel_spec = mel_input[0].cpu().numpy()
|
||||
@@ -139,7 +136,8 @@ class TestTTSDataset(unittest.TestCase):
|
||||
linear_spec = linear_input[0].cpu().numpy()
|
||||
wav = self.ap.inv_spectrogram(linear_spec.T)
|
||||
self.ap.save_wav(wav, OUTPATH + '/linear_inv_dataloader.wav')
|
||||
shutil.copy(item_idx[0], OUTPATH + '/linear_target_dataloader.wav')
|
||||
shutil.copy(item_idx[0],
|
||||
OUTPATH + '/linear_target_dataloader.wav')
|
||||
|
||||
# check the last time step to be zero padded
|
||||
assert linear_input[0, -1].sum() == 0
|
||||
@@ -192,4 +190,4 @@ class TestTTSDataset(unittest.TestCase):
|
||||
|
||||
# check batch conditions
|
||||
assert (linear_input * stop_target.unsqueeze(2)).sum() == 0
|
||||
assert (mel_input * stop_target.unsqueeze(2)).sum() == 0
|
||||
assert (mel_input * stop_target.unsqueeze(2)).sum() == 0
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
|
||||
"save_step": 200,
|
||||
"data_path": "/home/erogol/Data/LJSpeech-1.1/",
|
||||
"data_path_cache": "/media/erogol/data_ssd/Data/Nancy/tts_cache/",
|
||||
"output_path": "result",
|
||||
"min_seq_len": 0,
|
||||
"max_seq_len": 300,
|
||||
|
||||
Reference in New Issue
Block a user