Code Monkey home page Code Monkey logo

encodec.cpp's Introduction

encodec.cpp

encodec.cpp

Actions Status License: MIT

High-performance inference of Meta's Encodec deep learning based audio codec model:

  • Plain C/C++ implementation without dependencies using ggml

Demo

Here is a demo of running Encodec on a single M1 MacBook Pro:

demo.mp4

Roadmap

  • Support of 24Khz model
  • Mixed F16 / F32 precision
  • 4-bit and 8-bit quantization
  • Metal support
  • cuBLAS support

Implementation details

  • The core tensor operations are implemented in C (ggml.h / ggml.c)
  • The encoder-decoder architecture and the high-level C-style API are implemented in C++ (encodec.h / encodec.cpp)
  • Basic usage is demonstrated in main.cpp.

Usage

Here are the steps for the bark model.

Get the code

git clone --recurse-submodules https://github.com/PABannier/encodec.cpp.git
cd encodec.cpp

Build

In order to build encodec.cpp you must use CMake:

mkdir build
cd build
cmake ..
cmake --build . --config Release

Using Metal

Offloading to GPU is possible with the Metal backend for MacOS. Performance are not improved but the power consumption and CPU activity is reduced.

cmake -DGGML_METAL=ON -DBUILD_SHARED_LIBS=Off ..
cmake --build . --config Release

Using cuBLAS

The inference can be offloaded on a CUDA backend with cuBLAS.

cmake -DGGML_CUBLAS=ON -DBUILD_SHARED_LIBS=Off ..
cmake --build . --config Release

encodec.cpp's People

Contributors

pabannier avatar bachittle avatar

Stargazers

 avatar r0 avatar Jim Straub avatar randydom avatar peppemas avatar  avatar Gary Simmons avatar  avatar Shaji avatar Kouji Matsui avatar Atsushi Eno avatar Heberti Almeida avatar Rosen Velikov avatar Jeroen Janssen avatar Matt Stancliff avatar Basil Alasadi avatar  avatar  avatar Riccardo Mazza avatar Akash avatar Martin Gerhardy avatar  avatar Prof Syd Xu avatar engineer1109 avatar  avatar Mara Robin B. avatar Austin avatar Sefa Alper avatar  avatar Robert Macrae avatar कारतोफ्फेलस्क्रिप्ट™ avatar UEXTM.com avatar Pifometricien avatar Thorsten Sommer avatar P. Arndt avatar  avatar  avatar  avatar Caleb avatar Davud Kakaie avatar luisarandas avatar Akash Singh avatar Futuremapper avatar  avatar Shitty Girl avatar gotomypc avatar Lee Azzarello avatar Alexey Korepanov avatar Theo Paris avatar Volodymyr Kyrylov avatar  avatar Ahmad Mushtaq avatar Fabio Dias Rollo avatar 喵哩个咪 avatar syddharth avatar Jacob Goodale avatar  avatar Narain  avatar Yakov Till avatar Arthur avatar Yusuke Hata avatar  avatar Joshua Job avatar khimaros avatar Qian Liu avatar xiangxudong avatar Vector Ventures avatar hangtingchen avatar MaxMax avatar Renan Batista avatar Nick Steele avatar Cyberhan123 avatar Fojle Rabbi avatar doc-hex avatar Nick Arner avatar Nick Ovchinnikov avatar  avatar Andrius Gabriel da Luz avatar JavaGT avatar Monty Anderson avatar Barney Hill avatar Don Park avatar Noe Casas avatar  avatar  avatar Roy Shilkrot avatar Matt Parrett avatar Airpods69 avatar Lou Punit avatar  avatar  avatar  avatar zzh avatar Saad Nadeem avatar SrGnis avatar  avatar Jam avatar  avatar  avatar Jonathan Fly avatar

Watchers

Noe Casas avatar Georgi Gerganov avatar Nickolay V. Shmyrev avatar Erik Scholz avatar  avatar randydom avatar Yunlin Chen avatar JavaGT avatar  avatar Wendong Gan avatar

encodec.cpp's Issues

Steps needed to support the 48khz model

Hey, Thankyou for all your work, I was wondering can this be extended to support the 48khz model? What all will that require, is it simple? Would love to contribute if someone can provide some guidance.

Thanks!

not enough space in context's memory pool

read_wav_from_disk: Number of frames read = 1577459.
ggml_new_object: not enough space in the context's memory pool (needed 39200416, available 39200096)
compress: /mnt/c/prog/fork/encodec.cpp/ggml/src/ggml.c:4858: ggml_new_object: Assertion `false' failed.
Aborted

This looks similar to the unresolved bark.cpp error: PABannier/bark.cpp#122

Now that I have been experimenting, I believe it is due to the size of the file. If it is above 1mb it cannot fit into the buffer. So even if the file is like 10-15 seconds in length, its too big for the buffer.

too many initializers

get the following errors when compiling main and v0.1.0:
image

It is related to ggml.c compilation, I believe you are using a custom fork with changes to it, and that version is not working, but it was since October 2023 so I'm unsure what the reason is.

Maybe it's because I'm using MSVC and Windows instead of Mac?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.