Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Facebookresearch Audiocraft StreamingModule

From Leeroopedia
Knowledge Sources
Domains Audio_Processing, Streaming
Last Updated 2026-02-14 01:00 GMT

Overview

Concrete tool for enabling incremental/causal processing of audio sequences where modules maintain internal state between calls.

Description

StreamingModule and StreamingSequential provide the base infrastructure for streaming (causal) processing in AudioCraft. StreamingModule adds a state dictionary that persists between forward calls, enabling modules to process audio incrementally. StreamingSequential chains multiple streaming modules.

Usage

Import these base classes when building streaming-capable audio processing modules (convolutions, transformers, encoders).

Code Reference

Source Location

Signature

class StreamingModule(nn.Module):
    def __init__(self): ...
    def _streaming_state(self): ...
    def set_streaming_enabled(self, enabled: bool): ...
    def flush(self, x: tp.Optional[torch.Tensor] = None): ...

class StreamingSequential(StreamingModule, nn.Sequential): ...

Import

from audiocraft.modules.streaming import StreamingModule, StreamingSequential

I/O Contract

Inputs

Name Type Required Description
x torch.Tensor Yes Input tensor (streamed chunk)

Outputs

Name Type Description
output torch.Tensor Processed output (same or reduced length)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment