Skip to content

PaddleSpeech Architecture

Hui Zhang edited this page Feb 11, 2022 · 12 revisions

Design Philosophy

ppspeech_layout

For rapidly iteration of speech model and simplify model development and maintain, overly unified architecture is not appropriate, so we organize code as model first.

For common module, such as audio and text feature transformation and augmentation, we implement as library. We want implement model training/validation process as compose of these fundamental modules.

For each speech task, we have an exp and models directory. Under it, we create an directory named by model name. So we can do specific process for model, e.g. more fine data and/or feature processing, complicate training and/or evaluation loop.

We implement some recipe for conventional speech task, which on common dataset with performance reported, user can apply these template to private data or implement new model follow your own opinion. The philosophy make it easy to use, development and extension,which will accelerating industrial and/or academic iteration.

Layout of Source File

Full directory structure as follows:

paddlespeech
β”œβ”€β”€ cli
β”‚Β Β  β”œβ”€β”€ asr
β”‚Β Β  β”œβ”€β”€ cls
β”‚Β Β  β”œβ”€β”€ st
β”‚Β Β  β”œβ”€β”€ text
β”‚Β Β  └── tts
β”œβ”€β”€ cls
β”‚Β Β  β”œβ”€β”€ exps
β”‚Β Β  β”‚Β Β  └── panns
β”‚Β Β  β”‚Β Β      └── deploy
β”‚Β Β  └── models
β”‚Β Β      └── panns
β”œβ”€β”€ s2t
β”‚Β Β  β”œβ”€β”€ decoders
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ beam_search
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ctcdecoder
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── tests
β”‚Β Β  β”‚Β Β  └── scorers
β”‚Β Β  β”œβ”€β”€ exps
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ deepspeech2
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── bin
β”‚Β Β  β”‚Β Β  β”‚Β Β      └── deploy
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ lm
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── transformer
β”‚Β Β  β”‚Β Β  β”‚Β Β      └── bin
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ u2
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── bin
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ u2_kaldi
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── bin
β”‚Β Β  β”‚Β Β  └── u2_st
β”‚Β Β  β”‚Β Β      └── bin
β”‚Β Β  β”œβ”€β”€ frontend
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ augmentor
β”‚Β Β  β”‚Β Β  └── featurizer
β”‚Β Β  β”œβ”€β”€ io
β”‚Β Β  β”œβ”€β”€ models
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ds2
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ds2_online
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ lm
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ u2
β”‚Β Β  β”‚Β Β  └── u2_st
β”‚Β Β  β”œβ”€β”€ modules
β”‚Β Β  β”œβ”€β”€ training
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ extensions
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ triggers
β”‚Β Β  β”‚Β Β  └── updaters
β”‚Β Β  β”œβ”€β”€ transform
β”‚Β Β  └── utils
β”œβ”€β”€ t2s
β”‚Β Β  β”œβ”€β”€ audio
β”‚Β Β  β”œβ”€β”€ data
β”‚Β Β  β”œβ”€β”€ datasets
β”‚Β Β  β”œβ”€β”€ exps
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ fastspeech2
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ gan_vocoder
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ hifigan
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ multi_band_melgan
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ parallelwave_gan
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── style_melgan
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ new_tacotron2
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ speedyspeech
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ tacotron2
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ transformer_tts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ voice_cloning
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── tacotron2_ge2e
β”‚Β Β  β”‚Β Β  └── waveflow
β”‚Β Β  β”œβ”€β”€ frontend
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ normalizer
β”‚Β Β  β”‚Β Β  └── zh_normalization
β”‚Β Β  β”œβ”€β”€ models
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ fastspeech2
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ hifigan
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ melgan
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ new_tacotron2
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ parallel_wavegan
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ speedyspeech
β”‚Β Β  β”‚Β Β  └── transformer_tts
β”‚Β Β  β”œβ”€β”€ modules
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ conformer
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ predictor
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ tacotron2
β”‚Β Β  β”‚Β Β  └── transformer
β”‚Β Β  β”œβ”€β”€ training
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ extensions
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ triggers
β”‚Β Β  β”‚Β Β  └── updaters
β”‚Β Β  └── utils
β”œβ”€β”€ text
β”‚Β Β  β”œβ”€β”€ exps
β”‚Β Β  β”‚Β Β  └── ernie_linear
β”‚Β Β  └── models
β”‚Β Β      β”œβ”€β”€ ernie_crf
β”‚Β Β      └── ernie_linear
└── vector
    β”œβ”€β”€ exps
    β”‚Β Β  └── ge2e
    └── models

97 directories

Speech Task and Toolbox

speech task as follows:

paddlespeech
β”œβ”€β”€ cls (audio classfication/detection, emotion/gender/age recognition and so on)
β”œβ”€β”€ s2t (speech to text task, e.g ASR, ST)
β”œβ”€β”€ t2s (text to speech, e.g TTS, Voice Cloning, Voice Conversion, Music, Sing Voice Synthesis)
β”œβ”€β”€ text (speech related text task, e.g. punctuation restoration, text corrector, model based text front-end)
└── vector (speech task which need extracting vector feature, e.g Speaker Verification/Identification, Language Identification, Speaker Dirazation)

speech toolbox as follows:

paddlespeech
β”œβ”€β”€ cli (CLI toolbox for multi speech task)
└── server (Server/Client for speech task)

Exps and Models

exps contains bins for model, models contains implementation and specific process. Each speech task has these directories.

β”œβ”€β”€ t2s
β”‚   β”œβ”€β”€ exps
β”‚   β”‚   β”œβ”€β”€ fastspeech2
β”‚   β”‚   β”œβ”€β”€ gan_vocoder
β”‚   β”‚   β”‚   β”œβ”€β”€ hifigan
β”‚   β”‚   β”‚   β”œβ”€β”€ multi_band_melgan
β”‚   β”‚   β”‚   β”œβ”€β”€ parallelwave_gan
β”‚   β”‚   β”‚   └── style_melgan
β”‚   β”‚   β”œβ”€β”€ new_tacotron2
β”‚   β”‚   β”œβ”€β”€ speedyspeech
β”‚   β”‚   β”œβ”€β”€ tacotron2
β”‚   β”‚   β”œβ”€β”€ transformer_tts
β”‚   β”‚   β”œβ”€β”€ voice_cloning
β”‚   β”‚   β”‚   └── tacotron2_ge2e
β”‚   β”‚   └── waveflow
β”‚   β”œβ”€β”€ models
β”‚   β”‚   β”œβ”€β”€ fastspeech2
β”‚   β”‚   β”œβ”€β”€ hifigan
β”‚   β”‚   β”œβ”€β”€ melgan
β”‚   β”‚   β”œβ”€β”€ new_tacotron2
β”‚   β”‚   β”œβ”€β”€ parallel_wavegan
β”‚   β”‚   β”œβ”€β”€ speedyspeech
β”‚   β”‚   └── transformer_tts

All model implementation and updater core process are put in models, like bellow:

paddlespeech/t2s/models/
β”œβ”€β”€ __init__.py
β”œβ”€β”€ fastspeech2
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ fastspeech2.py
β”‚   └── fastspeech2_updater.py
β”œβ”€β”€ hifigan
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ hifigan.py
β”‚   └── hifigan_updater.py
β”œβ”€β”€ melgan
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ melgan.py
β”‚   β”œβ”€β”€ multi_band_melgan_updater.py
β”‚   β”œβ”€β”€ style_melgan.py
β”‚   └── style_melgan_updater.py
β”œβ”€β”€ new_tacotron2
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ tacotron2.py
β”‚   └── tacotron2_updater.py
β”œβ”€β”€ parallel_wavegan
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ parallel_wavegan.py
β”‚   └── parallel_wavegan_updater.py
β”œβ”€β”€ speedyspeech
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ speedyspeech.py
β”‚   └── speedyspeech_updater.py
β”œβ”€β”€ tacotron2.py
β”œβ”€β”€ transformer_tts
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ transformer_tts.py
β”‚   └── transformer_tts_updater.py
└── waveflow.py

7 directories, 26 files

fastspeech2.py is the model implementation, fastspeech2_updater.py is for train and valid core process.

We put train/valid/test and other process in exps directory, like bellow:

paddlespeech/t2s/exps/
β”œβ”€β”€ __init__.py
β”œβ”€β”€ fastspeech2
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ gen_gta_mel.py
β”‚   β”œβ”€β”€ normalize.py
β”‚   β”œβ”€β”€ preprocess.py
β”‚   β”œβ”€β”€ train.py
β”‚   └── voice_cloning.py
paddlespeech/s2t/exps/
β”œβ”€β”€ __init__.py
β”œβ”€β”€ deepspeech2
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ bin
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ deploy
β”‚   β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”‚   β”œβ”€β”€ client.py
β”‚   β”‚   β”‚   β”œβ”€β”€ record.py
β”‚   β”‚   β”‚   β”œβ”€β”€ runtime.py
β”‚   β”‚   β”‚   β”œβ”€β”€ send.py
β”‚   β”‚   β”‚   └── server.py
β”‚   β”‚   β”œβ”€β”€ export.py
β”‚   β”‚   β”œβ”€β”€ test.py
β”‚   β”‚   β”œβ”€β”€ test_export.py
β”‚   β”‚   β”œβ”€β”€ test_wav.py
β”‚   β”‚   └── train.py
β”‚   └── model.py
β”œβ”€β”€ lm
β”‚   └── transformer
β”‚       β”œβ”€β”€ __init__.py
β”‚       β”œβ”€β”€ bin
β”‚       β”‚   β”œβ”€β”€ __init__.py
β”‚       β”‚   └── cacu_perplexity.py
β”‚       └── lm_cacu_perplexity.py
β”œβ”€β”€ u2
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ bin
β”‚   β”‚   β”œβ”€β”€ __init__.py
β”‚   β”‚   β”œβ”€β”€ alignment.py
β”‚   β”‚   β”œβ”€β”€ export.py
β”‚   β”‚   β”œβ”€β”€ test.py
β”‚   β”‚   β”œβ”€β”€ test_wav.py
β”‚   β”‚   └── train.py
β”‚   β”œβ”€β”€ model.py
β”‚   └── trainer.py