neuphonic/neucodec-onnx-decoder-int8

🤗 Hugging Face 来源audio-to-audioapache-2.0312 MBother✓ 1 个校验和今天更新
帮助这个模型通过 Pirate Face 分发

模型卡、文件列表和校验和已在此收录。如果你持有文件并有权分享,可以提交种子,让其他人从节点下载。

获取来源文件需要 Hugging Face 批准。
为此模型做种

NeuCodec Onnx Decoder

This is an onnx-compiled version of the decoder of NeuCodec, quantized to int8. It's main use case is providing a low footprint decoder for on-device TTS.

Usage

import librosa
import torch
import soundfile as sf
from torchaudio import transforms as T
from neucodec import NeuCodec, NeuCodecOnnxDecoder
 
model = NeuCodec.from_pretrained("neuphonic/neucodec")
model.eval()
compiled_model = NeuCodecOnnxDecoder.from_pretrained("neuphonic/neucodec-onnx-decoder-int8")
 
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 = compiled_model.decode_code(fsq_codes) # (B, 1, T_24)

sf.write("reconstructed.wav", recon, 24_000)