EfficientSpeech oder TTS ist ein effizientes Modell für neuronale Text -zu -Sprache (TTS). Es erzeugt MEL -Spektrogramm mit einer Geschwindigkeit von 104 (MRTF) oder 104 Sekunden Sprache pro Sec. Auf einem RPI4. Die winzige Version hat einen Fußabdruck von nur 266.000 Parametern - etwa 1% nur moderner TTs wie Mixertts. Die Erzeugung von 6 Sekunden Sprache verbraucht nur 90 Mflops.
EfficientSpeech ist ein flaches (2 Blöcke!) Pyramidentransformator, der einem U-Net ähnelt. Upsampling erfolgt durch eine trennbare trennbare Faltung der Tiefe.
Installieren
ES migriert derzeit zu Pytorch 2.0 und Lightning 2.0. Erwarten Sie instabile Funktionen.
pip install -r requirements.txt
Wenn Sie auf Probleme mit Krublas gestoßen sind:
pip uninstall nvidia_cublas_cu11
Winzige es
python3 demo.py --checkpoint https://github.com/roatienza/efficientspeech/releases/download/pytorch2.0.1/tiny_eng_266k.ckpt
--infer-device cpu --text "the quick brown fox jumps over the lazy dog" --wav-filename fox.wav
Die Ausgabedatei befindet sich unter outputs . Spielen Sie die WAV -Datei ab:
ffplay outputs/fox.wav
Nach dem Herunterladen der Gewichte kann es wiederverwendet werden:
python3 demo.py --checkpoint tiny_eng_266k.ckpt --infer-device cpu
--text "In additive color mixing, which is used for displays such as computer screens and televisions, the primary colors are red, green, and blue."
--wav-filename color.wav
Wiedergabe:
ffplay outputs/color.wav
Kleine es
python3 demo.py --checkpoint https://github.com/roatienza/efficientspeech/releases/download/pytorch2.0.1/small_eng_952k.ckpt
--infer-device cpu --n-blocks 3 --reduction 2
--text "Bees are essential pollinators responsible for fertilizing plants and facilitating the growth of fruits, vegetables, and flowers. Their sophisticated social structures and intricate communication systems make them fascinating and invaluable contributors to ecosystems worldwide."
--wav-filename bees.wav
Wiedergabe:
ffplay outputs/color-small.wav
Basis es
python3 demo.py --checkpoint https://github.com/roatienza/efficientspeech/releases/download/pytorch2.0.1/base_eng_4M.ckpt
--head 2 --reduction 1 --expansion 2 --kernel-size 5 --n-blocks 3 --block-depth 3 --infer-device cpu
--text "Why do bees have sticky hair?" --wav-filename bees-base.wav
Wiedergabe:
ffplay outputs/bees-base.wav
GPU für Inferenz
Und mit einem langen Text. Auf einer A100 kann dies RTF> 1.300 erreichen. Zeit mit der Option --iter 100 .
python3 demo.py --checkpoint small_eng_952k.ckpt
--infer-device cuda --n-blocks 3 --reduction 2
--text "Once upon a time, in a magical forest filled with colorful flowers and sparkling streams, there lived a group of adorable kittens. Their names were Fluffy, Sparkle, and Whiskers. With their soft fur and twinkling eyes, they charmed everyone they met. Every day, they would play together, chasing their tails and pouncing on sunbeams that danced through the trees. Their purrs filled the forest with joy, and all the woodland creatures couldn't help but smile whenever they saw the cute trio. The animals knew that these kittens were truly the epitome of cuteness, bringing happiness wherever they went."
--wav-filename cats.wav --iter 100
Die kompilierte Option wird unter Verwendung von --compile während des Trainings oder der Inferenz unterstützt. Für das Training ist der eifrige Modus schneller. Das winzige Versionstraining beträgt ~ 17 Stunden auf einem A100. Für Inferenz ist die kompilierte Version schneller. Aus einem unbekannten Grund wird die Kompilierungsoption bei --infer-device cuda erzeugt.
Standardmäßig verwendet Pytorch 2.0 128 CPU -Threads (AMD, 4 in RPI4), wodurch während der Inferenz eine Verlangsamung führt. Während der Inferenz wird empfohlen, es auf eine niedrigere Zahl einzustellen. Zum Beispiel: --threads 24 .
Pytorch 2.0 ist auf RPI4 langsamer. Bitte verwenden Sie die Demo Release und ICASP2023 Modellgewichte.
RTF auf Pytorch 2.0 ist ~ 1,0. RTF auf Pytorch 1.12 ist ~ 1.7.
Alternativ verwenden Sie bitte die OnNX -Version:
python3 demo.py --checkpoint https://github.com/roatienza/efficientspeech/releases/download/pytorch2.0.1/tiny_eng_266k.onnx
--infer-device cpu --text "the primary colors are red, green, and blue." --wav-filename primary.wav
Unterstützt nur die Länge des Fixed -Eingangs. Bei Bedarf wird die Polsterung oder Kürzung angewendet. Ändern Sie mit --onnx-insize=<desired valu> . Die Standard -Länge der maximalen Phonem beträgt 128. Zum Beispiel:
python3 convert.py --checkpoint tiny_eng_266k.ckpt --onnx tiny_eng_266k.onnx --onnx-insize 256
Wählen Sie einen Datensatzordner: zB <data_folder> = /data/tts - Verzeichnis, in dem der Datensatz gespeichert wird.
Ljspeech herunterladen:
cd <data_folder>
wget https://data.keithito.com/data/speech/LJSpeech-1.1.tar.bz2
tar zxvf LJSpeech-1.1.tar.bz2
Bereiten Sie den Datensatz vor: <parent_folder> - wobei die Effizienzgeschwindigkeit geklont wurde.
cd <parent_folder>/efficientspeech
config/LJSpeech/preprocess.yaml bearbeiten:
>>>>>>>>>>>>>>>>>
path:
corpus_path: "/data/tts/LJSpeech-1.1"
lexicon_path: "lexicon/librispeech-lexicon.txt"
raw_path: "/data/tts/LJSpeech-1.1/wavs"
preprocessed_path: "./preprocessed_data/LJSpeech"
>>>>>>>>>>>>>>>>
Ersetzen Sie /data/tts durch Ihr <data_folder> .
Download Alignment -Daten von hier von preprocessed_data/LJSpeech/TextGrid .
Bereiten Sie den Datensatz vor:
python3 prepare_align.py config/LJSpeech/preprocess.yaml
Dies dauert ungefähr eine Stunde.
Für weitere Informationen: Fastspeech2 -Implementierung zur Erstellung des Datensatzes.
Winzige es
Standardmäßig:
--precision=16 . Weitere Optionen: "bf16-mixed", "16-mixed", 16, 32, 64 .--accelerator=gpu--infer-device=cuda--devices=1utils/tools.py python3 train.py
Kleine es
python3 train.py --n-blocks 3 --reduction 2
Basis es
python3 train.py --head 2 --reduction 1 --expansion 2 --kernel-size 5 --n-blocks 3 --block-depth 3
ES vs FS2 gegen Portaspeech gegen Lightspeech
Wenn Sie diese Arbeit nützlich finden, zitieren Sie bitte:
@inproceedings{atienza2023efficientspeech,
title={EfficientSpeech: An On-Device Text to Speech Model},
author={Atienza, Rowel},
booktitle={ICASSP 2023-2023 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)},
pages={1--5},
year={2023},
organization={IEEE}
}