audio
¶
Classes¶
fastvideo.models.audio.LTX2AudioDecoder
¶
fastvideo.models.audio.LTX2AudioEncoder
¶
fastvideo.models.audio.LTX2Vocoder
¶
Modules¶
fastvideo.models.audio.ltx2_audio_processing
¶
Audio preprocessing helpers for LTX-2 training.
Classes¶
fastvideo.models.audio.ltx2_audio_processing.AudioProcessor
¶
Bases: Module
Converts audio waveforms to log-mel spectrograms with resampling.
Source code in fastvideo/models/audio/ltx2_audio_processing.py
fastvideo.models.audio.ltx2_audio_vae
¶
Native LTX-2 Audio VAE and Vocoder implementation for FastVideo.
Classes¶
fastvideo.models.audio.ltx2_audio_vae.AttentionType
¶
fastvideo.models.audio.ltx2_audio_vae.AttnBlock
¶
Bases: Module
Vanilla self-attention block for 2D features.
Source code in fastvideo/models/audio/ltx2_audio_vae.py
fastvideo.models.audio.ltx2_audio_vae.AudioDecoder
¶
AudioDecoder(*, ch: int, out_ch: int, ch_mult: Tuple[int, ...] = (1, 2, 4, 8), num_res_blocks: int, attn_resolutions: Set[int], resolution: int, z_channels: int, norm_type: NormType = GROUP, causality_axis: CausalityAxis = WIDTH, dropout: float = 0.0, mid_block_add_attention: bool = True, sample_rate: int = 16000, mel_hop_length: int = 160, is_causal: bool = True, mel_bins: int | None = None)
Bases: Module
Symmetric decoder that reconstructs audio spectrograms from latent features.
Source code in fastvideo/models/audio/ltx2_audio_vae.py
1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 | |
Methods:¶
fastvideo.models.audio.ltx2_audio_vae.AudioDecoder.forward
¶Decode latent features back to audio spectrograms. Args: sample: Encoded latent representation of shape (batch, channels, frames, mel_bins) Returns: Reconstructed audio spectrogram of shape (batch, channels, time, frequency)
Source code in fastvideo/models/audio/ltx2_audio_vae.py
fastvideo.models.audio.ltx2_audio_vae.AudioDecoderConfigurator
¶
Factory for AudioDecoder from checkpoint config.
fastvideo.models.audio.ltx2_audio_vae.AudioEncoder
¶
AudioEncoder(*, ch: int, ch_mult: Tuple[int, ...] = (1, 2, 4, 8), num_res_blocks: int, attn_resolutions: Set[int], dropout: float = 0.0, resamp_with_conv: bool = True, in_channels: int, resolution: int, z_channels: int, double_z: bool = True, attn_type: AttentionType = VANILLA, mid_block_add_attention: bool = True, norm_type: NormType = GROUP, causality_axis: CausalityAxis = WIDTH, sample_rate: int = 16000, mel_hop_length: int = 160, n_fft: int = 1024, is_causal: bool = True, mel_bins: int = 64, **_ignore_kwargs)
Bases: Module
Encoder that compresses audio spectrograms into latent representations.
Source code in fastvideo/models/audio/ltx2_audio_vae.py
1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 | |
Methods:¶
fastvideo.models.audio.ltx2_audio_vae.AudioEncoder.forward
¶Encode audio spectrogram into latent representations. Args: spectrogram: Input spectrogram of shape (batch, channels, time, frequency) Returns: Encoded latent representation of shape (batch, channels, frames, mel_bins)
Source code in fastvideo/models/audio/ltx2_audio_vae.py
fastvideo.models.audio.ltx2_audio_vae.AudioEncoderConfigurator
¶
Factory for AudioEncoder from checkpoint config.
fastvideo.models.audio.ltx2_audio_vae.AudioLatentShape
¶
fastvideo.models.audio.ltx2_audio_vae.AudioPatchifier
¶
AudioPatchifier(patch_size: int = 1, sample_rate: int = 16000, hop_length: int = 160, audio_latent_downsample_factor: int = 4, is_causal: bool = True)
Simple patchifier for audio latents.
Source code in fastvideo/models/audio/ltx2_audio_vae.py
Methods:¶
fastvideo.models.audio.ltx2_audio_vae.AudioPatchifier.patchify
¶Flatten audio latent tensor along time: (B, C, T, F) -> (B, T, C*F).
fastvideo.models.audio.ltx2_audio_vae.AudioPatchifier.unpatchify
¶unpatchify(audio_latents: Tensor, output_shape: AudioLatentShape) -> Tensor
Restore (B, C, T, F) from flattened patches: (B, T, C*F) -> (B, C, T, F).
Source code in fastvideo/models/audio/ltx2_audio_vae.py
fastvideo.models.audio.ltx2_audio_vae.CausalConv2d
¶
CausalConv2d(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int = 1, dilation: int | Tuple[int, int] = 1, groups: int = 1, bias: bool = True, causality_axis: CausalityAxis = HEIGHT)
Bases: Module
A causal 2D convolution. Ensures output at time t only depends on inputs at time t and earlier.
Source code in fastvideo/models/audio/ltx2_audio_vae.py
fastvideo.models.audio.ltx2_audio_vae.CausalityAxis
¶
fastvideo.models.audio.ltx2_audio_vae.Downsample
¶
Downsample(in_channels: int, with_conv: bool, causality_axis: CausalityAxis = WIDTH)
Bases: Module
Downsampling layer with strided convolution or average pooling.
Source code in fastvideo/models/audio/ltx2_audio_vae.py
fastvideo.models.audio.ltx2_audio_vae.LTX2AudioDecoder
¶
fastvideo.models.audio.ltx2_audio_vae.LTX2AudioEncoder
¶
fastvideo.models.audio.ltx2_audio_vae.LTX2Vocoder
¶
fastvideo.models.audio.ltx2_audio_vae.NormType
¶
fastvideo.models.audio.ltx2_audio_vae.PerChannelStatistics
¶
PerChannelStatistics(latent_channels: int = 128)
Bases: Module
Per-channel statistics for normalizing and denormalizing the latent representation.
Source code in fastvideo/models/audio/ltx2_audio_vae.py
fastvideo.models.audio.ltx2_audio_vae.PixelNorm
¶
fastvideo.models.audio.ltx2_audio_vae.ResBlock1
¶
Bases: Module
1D ResBlock for vocoder with dilated convolutions.
Source code in fastvideo/models/audio/ltx2_audio_vae.py
fastvideo.models.audio.ltx2_audio_vae.ResBlock2
¶
Bases: Module
1D ResBlock for vocoder (simpler version).
Source code in fastvideo/models/audio/ltx2_audio_vae.py
fastvideo.models.audio.ltx2_audio_vae.ResnetBlock
¶
ResnetBlock(*, in_channels: int, out_channels: int | None = None, conv_shortcut: bool = False, dropout: float = 0.0, temb_channels: int = 512, norm_type: NormType = GROUP, causality_axis: CausalityAxis = HEIGHT)
Bases: Module
2D ResNet block for audio VAE.
Source code in fastvideo/models/audio/ltx2_audio_vae.py
fastvideo.models.audio.ltx2_audio_vae.Upsample
¶
Upsample(in_channels: int, with_conv: bool, causality_axis: CausalityAxis = HEIGHT)
Bases: Module
Upsampling layer with nearest-neighbor interpolation and optional convolution.
Source code in fastvideo/models/audio/ltx2_audio_vae.py
fastvideo.models.audio.ltx2_audio_vae.Vocoder
¶
Vocoder(resblock_kernel_sizes: List[int] | None = None, upsample_rates: List[int] | None = None, upsample_kernel_sizes: List[int] | None = None, resblock_dilation_sizes: List[List[int]] | None = None, upsample_initial_channel: int = 1024, stereo: bool = True, resblock: str = '1', output_sample_rate: int = 24000, activation: str = 'snake', use_tanh_at_final: bool = True, apply_final_activation: bool = True, use_bias_at_final: bool = True)
Bases: Module
Vocoder model for synthesizing audio from Mel spectrograms.
Source code in fastvideo/models/audio/ltx2_audio_vae.py
1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 | |
Methods:¶
fastvideo.models.audio.ltx2_audio_vae.Vocoder.forward
¶Forward pass of the vocoder. Args: x: Input Mel spectrogram tensor of shape (batch, channels, time, mel_bins) Returns: Audio waveform tensor of shape (batch, out_channels, audio_length)
Source code in fastvideo/models/audio/ltx2_audio_vae.py
fastvideo.models.audio.ltx2_audio_vae.VocoderConfigurator
¶
Factory for Vocoder from checkpoint config.
Functions:¶
fastvideo.models.audio.ltx2_audio_vae.build_downsampling_path
¶
build_downsampling_path(*, ch: int, ch_mult: Tuple[int, ...], num_resolutions: int, num_res_blocks: int, resolution: int, temb_channels: int, dropout: float, norm_type: NormType, causality_axis: CausalityAxis, attn_type: AttentionType, attn_resolutions: Set[int], resamp_with_conv: bool) -> Tuple[ModuleList, int]
Build the downsampling path with residual blocks, attention, and downsampling layers.
Source code in fastvideo/models/audio/ltx2_audio_vae.py
fastvideo.models.audio.ltx2_audio_vae.build_mid_block
¶
build_mid_block(channels: int, temb_channels: int, dropout: float, norm_type: NormType, causality_axis: CausalityAxis, attn_type: AttentionType, add_attention: bool) -> Module
Build the middle block with two ResNet blocks and optional attention.
Source code in fastvideo/models/audio/ltx2_audio_vae.py
fastvideo.models.audio.ltx2_audio_vae.build_normalization_layer
¶
build_normalization_layer(in_channels: int, *, num_groups: int = 32, normtype: NormType = GROUP) -> Module
Create a normalization layer based on the normalization type.
Source code in fastvideo/models/audio/ltx2_audio_vae.py
fastvideo.models.audio.ltx2_audio_vae.build_upsampling_path
¶
build_upsampling_path(*, ch: int, ch_mult: Tuple[int, ...], num_resolutions: int, num_res_blocks: int, resolution: int, temb_channels: int, dropout: float, norm_type: NormType, causality_axis: CausalityAxis, attn_type: AttentionType, attn_resolutions: Set[int], resamp_with_conv: bool, initial_block_channels: int) -> Tuple[ModuleList, int]
Build the upsampling path with residual blocks, attention, and upsampling layers.
Source code in fastvideo/models/audio/ltx2_audio_vae.py
fastvideo.models.audio.ltx2_audio_vae.decode_audio
¶
decode_audio(latent: Tensor, audio_decoder: AudioDecoder, vocoder: Vocoder) -> Tensor
Decode an audio latent representation using the provided audio decoder and vocoder.
Source code in fastvideo/models/audio/ltx2_audio_vae.py
fastvideo.models.audio.ltx2_audio_vae.make_attn
¶
make_attn(in_channels: int, attn_type: AttentionType = VANILLA, norm_type: NormType = GROUP) -> Module
Factory function for attention blocks.
Source code in fastvideo/models/audio/ltx2_audio_vae.py
fastvideo.models.audio.ltx2_audio_vae.make_conv2d
¶
make_conv2d(in_channels: int, out_channels: int, kernel_size: int | Tuple[int, int], stride: int = 1, padding: Tuple[int, int, int, int] | None = None, dilation: int = 1, groups: int = 1, bias: bool = True, causality_axis: CausalityAxis | None = None) -> Module
Create a 2D convolution layer that can be either causal or non-causal.
Source code in fastvideo/models/audio/ltx2_audio_vae.py
fastvideo.models.audio.ltx2_audio_vae.run_mid_block
¶
Run features through the middle block.