Skip to main content
Back

Hugging Face Ports Vocos Into Transformers, Making Fast Audio Decoding Effortless

Hugging Face has published Transformers-compatible checkpoints of Vocos, bringing the Fourier-based neural vocoder into the standard model API.

Pro

  • Hugging Face published Transformers-compatible Vocos checkpoints under the hf-audio organization
  • New VocosModel, VocosFeatureExtractor, and VocosProcessor classes replace the standalone vocos package
  • Two variants shipped: mel-spectrogram input and EnCodec RVQ token input, both at 24kHz
  • Vocos uses ConvNeXt backbone plus inverse Fourier transform, roughly 10x faster than time-domain vocoders
  • Integrates cleanly with Bark TTS for higher audio quality than EnCodec's default decoder
  • Model cards marked DRAFT, suggesting the native Transformers integration is still landing

The Hugging Face audio team has posted draft Transformers-compatible checkpoints of Vocos, a Fourier-based neural vocoder, under the hf-audio organization. The move ports the original charactr/vocos-mel-24khz and its EnCodec sibling into the standard transformers API, exposing them through new VocosModel, VocosFeatureExtractor, and VocosProcessor classes instead of a standalone pip install vocos package.

For anyone decoding mel spectrograms or EnCodec tokens back into waveforms, this changes how you wire the vocoder into your stack. Loading is a one-liner against the Hub, batching is handled by the feature extractor, and the model slots into the rest of the Transformers audio ecosystem, Bark included.

What actually shipped

Two checkpoints are now live as Transformers-compatible mirrors of the original models. The mel variant outputs 24kHz audio from mel spectrograms and mirrors charactr/vocos-mel-24khz. The EnCodec variant outputs 24kHz audio from EnCodec codes and mirrors charactr/vocos-encodec-24khz.

The model is tiny by modern standards, weighing 13.5M parameters and shipped as Safetensors. Usage looks like this:

from transformers import VocosModel, VocosFeatureExtractor
model_id = "hf-audio/vocos-mel-24khz"
feature_extractor = VocosFeatureExtractor.from_pretrained(model_id)
model = VocosModel.from_pretrained(model_id, device_map="auto")
inputs = feature_extractor(audio=audio, sampling_rate=24000).to(model.device)
outputs = model(**inputs)
audio_vocos = outputs.audio

For batches with varying lengths, the padding_mask output from VocosFeatureExtractor lets you reproduce single-file results, so you can slice the padded regions off after decoding.

Why Vocos in the first place

Vocos takes a different route than HiFi-GAN and MelGAN style vocoders. Rather than modeling audio samples in the time domain, it generates spectral coefficients and reconstructs the waveform through an inverse Fourier transform. Architecturally, it pairs a ConvNeXt backbone with an inverse Fourier transform head, either STFT or MDCT.

The payoff of that design is speed and cleanliness. Vocos reports roughly an order-of-magnitude speedup over prevailing time-domain neural vocoders, and its frequency-aware generator sidesteps the periodicity artifacts that often plague time-domain GANs. There are no learnable upsampling layers; the inverse Fourier transform reconstructs the original-scale waveform, with temporal resolution set by the STFT hop size.

Where it fits in a TTS pipeline

The most common integration story is with token-based text-to-speech systems. Bark encodes input text into discrete EnCodec RVQ codes and then uses EnCodec to convert those codes into a waveform, but the Vocos vocoder is frequently swapped in for EnCodec's decoder to lift audio quality. The new Transformers integration makes that swap trivial. You can use the Transformers implementation of Bark to generate quantized codes from text, then decode them with VocosProcessor and VocosModel in the same script, without leaving the library.

The EnCodec variant is particularly interesting because it can process precomputed RVQ codes directly. The processor takes quantized audio codes as input and converts them into embeddings for the Vocos model, so you can feed it output from any EnCodec-based codec LM.

Practical use cases

  • Drop-in replacement for HiFi-GAN in mel-spectrogram TTS pipelines where inference speed matters
  • Higher-quality decoding of EnCodec tokens produced by Bark or other neural codec language models
  • Copy-synthesis and audio reconstruction experiments where you want a fast, small vocoder
  • Fine-tuning for domain-specific voices, as projects like mesolitica/malaysian-vocos-mel-24khz have already done for regional languages

The caveats worth knowing

These checkpoints are labeled DRAFT on their model cards, which suggests the native VocosModel class is still landing in the Transformers library and may not be in a stable release yet. The original feature request to add Vocos to Transformers has been open since 2023, so this appears to be the actual implementation phase. For production stability today, the original gemelo-ai/vocos package still works and is what the vast majority of downstream users rely on, including the 3M+ downloads on the original mel checkpoint.

Both checkpoints keep the MIT license from the original release, and the underlying weights are unchanged, so quality parity with the standalone package should hold once the integration stabilizes.