fastspeech2 conformer with hifigan
Overview
Highlights
- Parallel synthesis for low-latency, real-time audio generation
- Conformer architecture improves prosody and speech naturalness
- HiFi-GAN vocoder ensures high-fidelity, crisp audio output
- Apache-2.0 license allows for flexible commercial integration
- Optimized for scalable production via the ESPnet framework
Usage
# Install Hugging Face transformers
pip install transformers torch
# Load model with transformers
from transformers import AutoModel, AutoTokenizer
model = AutoModel.from_pretrained("espnet/fastspeech2_conformer_with_hifigan")
tokenizer = AutoTokenizer.from_pretrained("espnet/fastspeech2_conformer_with_hifigan")
Hugging Face Download
We recommend downloading the model via the Hugging Face CLI or Hub SDK.
Guidance:Before downloading, install huggingface_hub with:
pip install -U huggingface_hub
CLI Download
Download the full repository
huggingface-cli download espnet/fastspeech2_conformer_with_hifigan
Download a single file to a local folder (e.g. config.json into ./dir)
huggingface-cli download espnet/fastspeech2_conformer_with_hifigan config.json --local-dir ./dir
See the official docs for more CLI options
SDK Download
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('espnet/fastspeech2_conformer_with_hifigan')
Git Download
Make sure git-lfs is installed first
git lfs install
git clone https://huggingface.co/espnet/fastspeech2_conformer_with_hifigan
To skip LFS large-file downloads, use:
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/espnet/fastspeech2_conformer_with_hifigan
Model files are hosted on the Hugging Face Hub — download directly via HF CLI / SDK / Git, not through this site.
PyTorch / Transformers Usage
Install Transformers
pip install -U transformers torch
Load the model and run inference
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained('espnet/fastspeech2_conformer_with_hifigan')
tokenizer = AutoTokenizer.from_pretrained('espnet/fastspeech2_conformer_with_hifigan')
Full Documentation
---
license: apache-2.0
language:
- en
library_name: transformers
---
FastSpeech2ConformerWithHifiGan
<!-- Provide a quick summary of what the model is/does. -->
This model combines FastSpeech2Conformer and FastSpeech2ConformerHifiGan into one model for a simpler and more convenient usage.
FastSpeech2Conformer is a non-autoregressive text-to-speech (TTS) model that combines the strengths of FastSpeech2 and the conformer architecture to generate high-quality speech from text quickly and efficiently, and the HiFi-GAN vocoder is used to turn generated mel-spectrograms into speech waveforms.
🤗 Transformers Usage
You can run FastSpeech2Conformer locally with the 🤗 Transformers library.
1. First install the 🤗 Transformers library and g2p-en:
pip install --upgrade pip
pip install --upgrade transformers g2p-en2. Run inference via the Transformers modelling code with the model and hifigan combined
from transformers import FastSpeech2ConformerTokenizer, FastSpeech2ConformerWithHifiGan
import soundfile as sf
tokenizer = FastSpeech2ConformerTokenizer.from_pretrained("espnet/fastspeech2_conformer")
inputs = tokenizer("Hello, my dog is cute.", return_tensors="pt")
input_ids = inputs["input_ids"]
model = FastSpeech2ConformerWithHifiGan.from_pretrained("espnet/fastspeech2_conformer_with_hifigan")
output_dict = model(input_ids, return_dict=True)
waveform = output_dict["waveform"]
sf.write("speech.wav", waveform.squeeze().detach().numpy(), samplerate=22050)