Downloads · 30 days
200
76% of all-time downloads
eugenehp/neucodec
neucodec is a audio-to-audio model from eugenehp. Use it for the audio-to-audio task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
[](https://www.youtube.com/watch?v=O7XH1lGZyYY)
Downloads · 30 days
200
76% of all-time downloads
All-time downloads
264
Public
Repo size
2 GB
Likes
2
Public
Click a slice to open those files.
.bin1.2 GB · 57%
From the Hugging Face model README
Click the image above to see NeuCodec in action on Youtube!
Created by Neuphonic - building faster, smaller, on-device voice AI
A lightweight neural codec that encodes audio at just 0.8 kbps - perfect for researchers and builders who need something that just works for training high quality text-to-speech models.
NeuCodec is a Finite Scalar Quantisation (FSQ) based 0.8kbps audio codec for speech tokenization. It takes advantage of the following features:
NeuCodec is largely based on extending the work of X-Codec2.0.
Use the code below to get started with the model.
To install from pypi in a dedicated environment, using Python 3.10 or above:
conda create -n neucodec python=3.10
conda activate neucodec
pip install neucodec
Then, to use in python:
import librosa
import torch
import torchaudio
from torchaudio import transforms as T
from neucodec import NeuCodec
model = NeuCodec.from_pretrained("neuphonic/neucodec")
model.eval().cuda()
y, sr = torchaudio.load(librosa.ex("libri1"))
if sr != 16_000:
y = T.Resample(sr, 16_000)(y)[None, ...] # (B, 1, T_16)
with torch.no_grad():
fsq_codes = model.encode_code(y)
# fsq_codes = model.encode_code(librosa.ex("libri1")) # or directly pass your filepath!
print(f"Codes shape: {fsq_codes.shape}")
recon = model.decode_code(fsq_codes).cpu() # (B, 1, T_24)
torchaudio.save("reconstructed.wav", recon[0, :, :], 24_000)
The model was trained using the following data:
All publically available data was covered by either the CC-BY-4.0 or CC0 license.