Implementation:Facebookresearch Audiocraft StreamingModule
| 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
- Repository: Facebookresearch_Audiocraft
- File: audiocraft/modules/streaming.py
- Lines: 1-131
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) |