Understand the Bark model architecture
mainBark is a generative text-to-audio model composed of three sequential transformer models. The pipeline transforms text into audio through three distinct stages of tokenization and decoding:
- Text to semantic tokens: Uses a causal transformer (80M parameters) to convert text (tokenized via Hugging Face's BERT tokenizer) into semantic tokens.
- Semantic to coarse tokens: Uses a causal transformer (80M parameters) to convert semantic tokens into the first two codebooks of the EnCodec codec.
- Coarse to fine tokens: Uses a non-causal transformer (80M parameters) to expand the first two EnCodec codebooks into the full 8 codebooks required for audio reconstruction.
This multi-stage approach allows the model to handle the complexity of language semantics before moving into the high-fidelity acoustic domain.