decoding
¶
Decoding stage for diffusion pipelines.
Classes¶
fastvideo.pipelines.stages.decoding.DecodingStage
¶
Bases: PipelineStage
Stage for decoding latent representations into pixel space.
This stage handles the decoding of latent representations into the final output format (e.g., pixel values).
Source code in fastvideo/pipelines/stages/decoding.py
Functions¶
fastvideo.pipelines.stages.decoding.DecodingStage.decode
¶
decode(latents: Tensor, fastvideo_args: FastVideoArgs) -> Tensor
Decode latent representations into pixel space using VAE.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latents
|
Tensor
|
Input latent tensor with shape (batch, channels, frames, height_latents, width_latents) |
required |
fastvideo_args
|
FastVideoArgs
|
Configuration containing: - disable_autocast: Whether to disable automatic mixed precision (default: False) - pipeline_config.vae_precision: VAE computation precision ("fp32", "fp16", "bf16") - pipeline_config.vae_tiling: Whether to enable VAE tiling for memory efficiency |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Decoded video tensor with shape (batch, channels, frames, height, width), |
Tensor
|
normalized to [0, 1] range and moved to CPU as float32 |
Source code in fastvideo/pipelines/stages/decoding.py
fastvideo.pipelines.stages.decoding.DecodingStage.forward
¶
forward(batch: ForwardBatch, fastvideo_args: FastVideoArgs) -> ForwardBatch
Decode latent representations into pixel space.
This method processes the batch through the VAE decoder, converting latent representations to pixel-space video/images. It also optionally decodes trajectory latents for visualization purposes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
batch
|
ForwardBatch
|
The current batch containing: - latents: Tensor to decode (batch, channels, frames, height_latents, width_latents) - return_trajectory_decoded (optional): Flag to decode trajectory latents - trajectory_latents (optional): Latents at different timesteps - trajectory_timesteps (optional): Corresponding timesteps |
required |
fastvideo_args
|
FastVideoArgs
|
Configuration containing: - output_type: "latent" to skip decoding, otherwise decode to pixels - vae_cpu_offload: Whether to offload VAE to CPU after decoding - model_loaded: Track VAE loading state - model_paths: Path to VAE model if loading needed |
required |
Returns:
| Type | Description |
|---|---|
ForwardBatch
|
Modified batch with: - output: Decoded frames (batch, channels, frames, height, width) as CPU float32 - trajectory_decoded (if requested): List of decoded frames per timestep |
Source code in fastvideo/pipelines/stages/decoding.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
fastvideo.pipelines.stages.decoding.DecodingStage.verify_input
¶
verify_input(batch: ForwardBatch, fastvideo_args: FastVideoArgs) -> VerificationResult
Verify decoding stage inputs.
Source code in fastvideo/pipelines/stages/decoding.py
fastvideo.pipelines.stages.decoding.DecodingStage.verify_output
¶
verify_output(batch: ForwardBatch, fastvideo_args: FastVideoArgs) -> VerificationResult
Verify decoding stage outputs.