Comments (6)
model = EncodecModel.encodec_model_24khz() # return the pretrained causal 24khz model
model.set_target_bandwidth(24) # use all of the 32 codebooks (24kpbs)
model.quantizer.vq.layers[5]._codebook.embed # to show the 5+1=6th codebook of RVQ. shape is (1024,128) corresponding to (nbr_entries, dimensionality)
from encodec.
Awesome! Thanks.
from encodec.
Hello,
I'm new to these codecs concepts. I didn't understand clearly, how these Codebooks are generated. Whether these are created on the fly or stored beforehand. Where Can I get complete information on code books creation and usage.
Thank You
from encodec.
Hi @HimaJyothi17, if I may answer your questions:
Whether these are created on the fly or stored beforehand.
The codebooks are created beforehand during training. Then you compute the most appropriate codes from these codebooks for a given audio on-the-fly. It is done by applying the RVQ algorithm on the continuous embedding of the audio signal provided by the Encoder.
Where Can I get complete information on code books creation and usage.
Maybe reading the original paper would be a good starting point π
from encodec.
Thanks for the reply @jhauret !!
I've already gone through the original paper. But I didn't find much info on Codebook Creation. They did mention that, they've used 32 codebooks and are updated with 0.99 decay.
But I need info on how they created those 32 codebooks. Is it predefined with approaches like kmeans or created dynamically during training with random initialization?
from encodec.
You're welcome! So the paper says that they followed the same procedure as Soundstream, which first introduced RVQ. In this Soundstream's paper you can find more details about codebook initialization and updates:
" The codebook of each quantizer is trained with exponential moving average updates, following the method proposed in VQ-VAE-2 [32]. To improve the usage of the codebooks we use two additional methods. First, instead of using a random initialization for the codebook vectors, we run the k-means algorithm on the first training batch and use the learned
centroids as initialization. This allows the codebook to be close to the distribution of its inputs and improves its usage. Second, as proposed in [34], when a codebook vector has not been assigned any input frame for several batches, we replace it with an input frame randomly sampled within the current batch. More precisely, we track the exponential moving average of the assignments to each vector (with a decay factor of 0.99) and replace the vectors of which this statistic falls below 2. "
from encodec.
Related Issues (20)
- Changing existing models and training them HOT 1
- RuntimeError: No audio I/O backend is available HOT 5
- Codebook expiration does not take effect at all HOT 2
- MS-STFTDiscriminator: Why concatenation is done in a form of padding the real part?
- RVQ's password book
- training dataset
- Low quality of the reconstruct audioοΌ HOT 2
- Interpolation between two audio clips? HOT 1
- License of the weights?
- Streaming example? HOT 1
- Encoding Long Audio Clips HOT 2
- Pretrained weights for model without lstm?
- Couldn't reach 'hf-internal-testing/librispeech_asr_dummy' on the Hub
- How STFT Discriminator Output Logits are used in Hinge Loss?
- Converting encodec model to ONNX
- Export Audio
- RuntimeError Couldn't find appropriate backend to handle uri {uri} and format {format}. HOT 5
- High bit rates
- Preparing Train Dataset (mixing strategy)
- Distributed Section Error in Encodec on Termux
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from encodec.