Implementation:Facebookresearch Audiocraft UnetTransformer
| Knowledge Sources | |
|---|---|
| Domains | Transformer, Model_Architecture |
| Last Updated | 2026-02-14 01:00 GMT |
Overview
Concrete tool for extending StreamingTransformer with U-Net-style skip connections between encoder and decoder halves.
Description
StreamingTransformerUnet extends StreamingTransformer by adding linear skip connections between the first half and second half of the transformer layers. Activations from layer i are projected and added to activations at the corresponding decoder layer (num_layers - 1 - i). This is used in diffusion U-Net models.
Usage
Import this class when building diffusion models that need transformer blocks with skip connections.
Code Reference
Source Location
- Repository: Facebookresearch_Audiocraft
- File: audiocraft/modules/unet_transformer.py
- Lines: 1-67
Signature
class StreamingTransformerUnet(StreamingTransformer):
def forward(self, x, *args, **kwargs): ...
Import
from audiocraft.modules.unet_transformer import StreamingTransformerUnet
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| x | torch.Tensor | Yes | Input tensor [B, T, D] |
Outputs
| Name | Type | Description |
|---|---|---|
| output | torch.Tensor | Transformer output with skip connections [B, T, D] |