GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - dachengai/FastSpeech: The Implementation of FastSpeech based on pytorch.

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

131 Commits
131 Commits

Folders and files

NameName
Last commit message
Last commit date
Tacotron2
Tacotron2
 
 
data
data
 
 
img
img
 
 
paper
paper
 
 
results
results
 
 
text
text
 
 
transformer
transformer
 
 
visualize_loss
visualize_loss
 
 
FastSpeech.py
FastSpeech.py
 
 
Networks.py
Networks.py
 
 
README.md
README.md
 
 
alignment.py
alignment.py
 
 
alignment_targets.zip
alignment_targets.zip
 
 
audio.py
audio.py
 
 
data_utils.py
data_utils.py
 
 
data_utils_accelerated.py
data_utils_accelerated.py
 
 
hparams.py
hparams.py
 
 
loss.py
loss.py
 
 
optimizer.py
optimizer.py
 
 
preprocess.py
preprocess.py
 
 
synthesis.py
synthesis.py
 
 
train.py
train.py
 
 
train_accelerated.py
train_accelerated.py
 
 

Repository files navigation

FastSpeech-Pytorch

The Implementation of FastSpeech Based on Pytorch.

Model

My Blog

  • FastSpeech Reading Notes
  • Details and Rethinking of this Implementation

Start

Dependencies

  • python 3.6
  • CUDA 10.0
  • pytorch 1.1.0
  • numpy 1.16.2
  • scipy 1.2.1
  • librosa 0.6.3
  • inflect 2.1.0
  • matplotlib 2.2.2

Prepare Dataset

  1. Download and extract LJSpeech dataset.
  2. Put LJSpeech dataset in data.
  3. Run preprocess.py.

Get Alignment from Tacotron2

Note

In the paper of FastSpeech, authors use pre-trained Transformer-TTS to provide the target of alignment. I didn't have a well-trained Transformer-TTS model so I use Tacotron2 instead.

Calculate Alignment during Training (slow)

Change pre_target = False in hparam.py

Calculate Alignment before Training

  1. Download the pre-trained Tacotron2 model published by NVIDIA here.
  2. Put the pre-trained Tacotron2 model in Tacotron2/pre_trained_model
  3. Run alignment.py, it will spend 7 hours training on NVIDIA RTX2080ti.

Use Calculated Alignment (quick)

I provide LJSpeech's alignments calculated by Tacotron2 in alignment_targets.zip. If you want to use it, just unzip it.

Run (Support Data Parallel)

Note

In the turbo mode, a prefetcher prefetches training data and this operation may cost more memory.

Normal Mode

Run train.py.

Turbo Mode

Run train_accelerated.py.

Test

Synthesize

Run synthesis.py.

Results

  • The examples of audio are in results. The sentence for synthesizing is "I am very happy to see you again.". results/normal.wav was synthesized when alpha = 1.0, results/slow.wav was synthesized when alpha = 1.5 and results/quick.wav was synthesized when alpha = 0.5.
  • The outputs and alignment of Tacotron2 are shown as follows (The sentence for synthesizing is "I want to go to CMU to do research on deep learning."):
  • The outputs and alignment of FastSpeech are shown as follows (The sentence for synthesizing is "I want to go to CMU to do research on deep learning."):

Loss Curve

The total_loss curve recorded from 30000th step to 140000th step is shown as follows:

Notes

  • If you want to use another model to get alignments, you need rewrite alignment.py.
  • The returned value of alignment.py is a tensor whose value is the multiple that encoder's outputs are supposed to be expanded by. For example:
test_target = torch.stack([torch.Tensor([0, 2, 3, 0, 3, 2, 1, 0, 0, 0]),
                           torch.Tensor([1, 2, 3, 2, 2, 0, 3, 6, 3, 5])])
  • The output of LengthRegulator's last linear layer passes through the ReLU activation function in order to remove negative values. It is the outputs of this module. During the inference, the output of LengthRegulator pass through torch.exp() and subtract one, as the multiple for expanding encoder output. During the training stage, duration targets add one and pass through torch.log() and then calculate loss. For example:
duration_predictor_target = duration_predictor_target + 1
duration_predictor_target = torch.log(duration_predictor_target)

duration_predictor_output = torch.exp(duration_predictor_output)
duration_predictor_output = duration_predictor_output - 1

Reference

  • The Implementation of Tacotron Based on Tensorflow
  • The Implementation of Transformer Based on Pytorch
  • The Implementation of Transformer-TTS Based on Pytorch
  • The Implementation of Tacotron2 Based on Pytorch

About

The Implementation of FastSpeech based on pytorch.

Resources

Readme
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.