Skip to content

Commit

Permalink
sample: Add sample
Browse files Browse the repository at this point in the history
  • Loading branch information
revsic committed Jul 10, 2021
1 parent 7858e52 commit cf2575a
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions sample.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import sys
sys.path.append('..')

import speechset


# construct data reader
lj = speechset.datasets.LJSpeech()

# construct configuration
config = speechset.Config()

# construct acoustic model
acoustic = speechset.AcousticDataset(lj, config)

# generate tf.data.Dataset
dataset, _ = acoustic.dataset()
# unpack
text, mel, textlen, mellen = next(iter(dataset))
print(text.shape, mel.shape, textlen.shape, mellen.shape)

# split sample
trainset, testset = acoustic.dataset(1000)
# unpack
text, mel, textlen, mellen = next(iter(trainset))
print(text.shape, mel.shape, textlen.shape, mellen.shape)

text, mel, textlen, mellen = next(iter(testset))
print(text.shape, mel.shape, textlen.shape, mellen.shape)

# construct vocoder model
vocoder = speechset.VocoderDataset(lj, config)

# generate tf.data.Dataset
dataset, _ = vocoder.dataset()
# unpack
mel, audio, mellen, audiolen = next(iter(dataset))
print(mel.shape, audio.shape, mellen.shape, audiolen.shape)

0 comments on commit cf2575a

Please sign in to comment.