Skip to content

mybigday/codec.cpp

Repository files navigation

codec.cpp

Neural audio codec inference in C/C++

The main goal of codec.cpp is to enable neural audio codec inference with minimal setup and state-of-the-art performance on a wide range of hardware — locally and in the cloud. Supports Mimi, DAC, WavTokenizer with quantization and multi-backend GPU acceleration.

Quick Start

1. Convert Models to GGUF

cd scripts

# From HuggingFace
python convert-to-gguf.py --model-id kyutai/mimi --output mimi.gguf

# From local checkpoint
python convert-to-gguf.py --input-dir ./mimi-checkpoint --output mimi.gguf

# With quantization (Q4_K_M, Q5_K_M, Q8_0)
python convert-to-gguf.py --model-id kyutai/mimi --output mimi-q4.gguf --quantization Q4_K_M

2. Decode Audio

./build/codec-cli decode --model mimi.gguf --codes input.npy --out output.wav

# With GPU acceleration (if built with CUDA/Vulkan/Metal)
./build/codec-cli decode --model mimi.gguf --codes input.npy --out output.wav --use-gpu

Build with GPU Acceleration

CUDA (NVIDIA)

cmake -B build -DGGML_CUDA=ON
cmake --build build -j
./build/codec-cli --model model.gguf --codes in.npy --out out.wav --use-gpu

Vulkan (Cross-platform)

cmake -B build -DGGML_VULKAN=ON
cmake --build build -j

Metal (macOS)

cmake -B build -DGGML_METAL=ON
cmake --build build -j

SYCL (Intel GPUs)

cmake -B build -DGGML_SYCL=ON
cmake --build build -j

OpenCL

cmake -B build -DGGML_OPENCL=ON
cmake --build build -j

CANN (Ascend)

cmake -B build -DGGML_CANN=ON
cmake --build build -j

HIP/ROCm (AMD GPUs)

cmake -B build -DGGML_HIP=ON
cmake --build build -j

MUSA

cmake -B build -DGGML_MUSA=ON
cmake --build build -j

WebGPU

cmake -B build -DGGML_WEBGPU=ON
cmake --build build -j

zDNN

cmake -B build -DGGML_ZDNN=ON
cmake --build build -j

VirtGPU

cmake -B build -DGGML_VIRTGPU=ON
cmake --build build -j

Multiple backends (fallback chain)

cmake -B build -DGGML_CUDA=ON -DGGML_VULKAN=ON
cmake --build build -j
# Runtime auto-selects: CUDA > Vulkan > CPU

CPU-only (default)

cmake -B build
cmake --build build -j
./build/codec-cli --model model.gguf --codes in.npy --out out.wav

License

MIT


Built and maintained by BRICKS.

About

Neural audio codec inference in C/C++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published