Files
wehub-resource-sync ba4be087d5
CICD NeMo / cicd-main-unit-tests (push) Blocked by required conditions
CICD NeMo / cicd-main-speech (push) Blocked by required conditions
CICD NeMo / cicd-test-container-build (push) Blocked by required conditions
CICD NeMo / cicd-import-tests (push) Blocked by required conditions
CICD NeMo / L0_Setup_Test_Data_And_Models (push) Blocked by required conditions
CICD NeMo / Nemo_CICD_Test (push) Blocked by required conditions
CICD NeMo / Coverage (e2e) (push) Blocked by required conditions
CICD NeMo / Coverage (unit-test) (push) Blocked by required conditions
CodeQL / Analyze (python) (push) Waiting to run
Create PR to main with cherry-pick from release / cherry-pick (push) Failing after 0s
CICD NeMo / pre-flight (push) Failing after 0s
CICD NeMo / configure (push) Has been skipped
Build, validate, and release Neural Modules / pre-flight (push) Failing after 1s
CICD NeMo / code-linting (push) Has been skipped
CICD NeMo / cicd-wait-in-queue (push) Waiting to run
Build, validate, and release Neural Modules / release (push) Has been skipped
Build, validate, and release Neural Modules / release-summary (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:28:58 +08:00

2.2 KiB

Overview

This PR introduces frame-stacking implementation in Magpie-TTS. Frame-stacking is disabled by default. It can be enabled by setting a frame_stacking_factor > 1 in the YAML config.

Frame-stacking

Overview

Frame-stacking is a technique that allows the Magpie-TTS base decoder (also known as the "main" for "first stage" decoder) to process multiple consecutive audio frames in a single forward pass, leaving the job of generating individual frames and codebooks to a second, smaller, "Local Transformer" ("LT") decoder. The goal is to accelerate inference by reducing the number of generation steps of the base decoder. In this two-stage approach:

  1. The base decoder processes multiple frames at once, producing a single latent representation for each group (stack) of frames
  2. The Local Transformer then generates the individual frames * codebooks tokens.

The Local Transformer is much faster than the base decoder, making this two-stage approach significantly faster than generating each frame with the base decoder. The speed improvement comes from two factors:

  • Fewer parameters: The LT decoder is lightweight compared to the base decoder
  • Shorter sequences: The LT decoder only attends to the current frame stack and the latent, not the entire frame sequence

The base decoder can also generate audio codes directly without a LT, but when frame-stacking is enabled using the LT decoder is typically necessary to achieve high-quality synthesis.

Design and Implementation

  • The frame_stacking_factor is the parameter that controls the number of frames to stack. The default is 1, which means no frame-stacking. We have tested values up to 4.
  • For each codebooks, we keep a separate embedding table for at each frame within the stack. At the input to the decoder, the embeddings are averages across codebooks (as usual) and also frames within the stack. The embedding tables are shared between the base and LT decoders.

Limitations

This is still WIP with more work to be done. Specifically, the following are not yet implemented / tested:

  • Online code extraction combined with frame-stacking.
  • Alignment encoder with frame-stacking.
  • CTC loss with frame-stacking.