fastspeech2 conformer with hifigan

Providerespnet
Categorytext-to-audio
Licenseapache-2.0
Downloads8.8K
Stars0

Overview

This model combines the FastSpeech 2 architecture with Conformer blocks and a HiFi-GAN vocoder to deliver high-fidelity, non-autoregressive text-to-speech. For developers, the primary advantage is the shift from sequential generation to parallel processing, which significantly reduces inference latency compared to traditional Tacotron-based systems. By integrating Conformer layers, the model better captures both local and global dependencies in speech patterns, resulting in more natural prosody and clearer articulation. It is an ideal choice for production environments requiring scalable, real-time audio synthesis where low jitter and high throughput are critical. Integration typically follows the ESPnet framework, making it compatible with standard PyTorch pipelines for custom voice fine-tuning or deployment in accessibility and virtual assistant applications.

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
# Install Hugging Face transformers
pip install transformers torch
SDK Usage
# 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:

Guidance
pip install -U huggingface_hub

CLI Download

Download the full repository

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)

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

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 Download
git lfs install
git clone https://huggingface.co/espnet/fastspeech2_conformer_with_hifigan

To skip LFS large-file downloads, use:

Skip LFS
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

Install Transformers
pip install -U transformers torch

Load the model and run inference

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

来源: HuggingFace

---
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:

code
pip install --upgrade pip
pip install --upgrade transformers g2p-en

2. Run inference via the Transformers modelling code with the model and hifigan combined

python
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)

Join our Telegram