kandinsky6_sr ¶
Kandinsky6 video super-resolution (SR) DiT.
A text-free Kandinsky6 DiT: no text tower and no cross-attention; a learned pooled_bias stands in for the pooled empty-caption embedding the model was trained with. The blocks reuse the Kandinsky6 building blocks (models/dits/kandinsky6.py). Input [B, T, H, W, 2C + 1] (noised latent | anchor | anchor mask), output [B, T, H, W, out_visual_dim] (n_grid * C for the pi-Flow checkpoint).
The residual stream stays in the model's compute_dtype between blocks, as in the Diffusers model. Modulation, norm and time-embedding maths happen in fp32 internally and are cast back to compute_dtype right after each gated residual add. Sequence parallelism is not supported (dense LocalAttention), and NABLA sparse attention is not wired.
Classes¶
fastvideo.models.dits.kandinsky6_sr.Kandinsky6SRDecoderBlock ¶
Kandinsky6SRDecoderBlock(model_dim: int, time_dim: int, ff_dim: int, head_dim: int, supported_attention_backends: tuple[AttentionBackendEnum, ...] | None = None, prefix: str = '', quant_config: QuantizationConfig | None = None)
Bases: Module
Text-free decoder block: modulated self-attention + modulated feed-forward (6 modulation params).
x = (x + gate * attention(LN(x) * (1 + scale) + shift)).to(compute_dtype) per sub-layer: the gated residual add happens in fp32 (matching the norm/modulation maths) and is cast back to compute_dtype immediately after, so the residual stream tracks the model's working dtype between blocks instead of staying fp32 forever after the first block.
Source code in fastvideo/models/dits/kandinsky6_sr.py
fastvideo.models.dits.kandinsky6_sr.Kandinsky6SROutLayer ¶
Kandinsky6SROutLayer(model_dim: int, time_dim: int, visual_dim: int, patch_size: tuple[int, int, int])
Bases: Kandinsky6OutLayer
Kandinsky6OutLayer for an fp32 residual stream: modulate in fp32, cast to the parameter dtype, project.
Source code in fastvideo/models/dits/kandinsky6.py
fastvideo.models.dits.kandinsky6_sr.Kandinsky6SRTransformer3DModel ¶
Bases: BaseDiT
forward(hidden_states [B, T, H, W, 2C + 1], timestep [B], visual_rope_pos, scale_factor) -> [B, T, H, W, out_visual_dim].
Source code in fastvideo/models/dits/kandinsky6_sr.py
Attributes¶
fastvideo.models.dits.kandinsky6_sr.Kandinsky6SRTransformer3DModel.compute_dtype property ¶
Parameter dtype of the linear stacks (the dtype the DiT input is cast to).
Methods:¶
fastvideo.models.dits.kandinsky6_sr.Kandinsky6SRTransformer3DModel.forward ¶
forward(hidden_states: Tensor, timestep: Tensor, visual_rope_pos: tuple[Tensor, Tensor, Tensor] | list[Tensor], scale_factor: tuple[float, ...] = (1.0, 1.0, 1.0), return_dict: bool = False, **kwargs: Any) -> Tensor
Run the DiT.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hidden_states | Tensor |
| required |
timestep | Tensor |
| required |
visual_rope_pos | tuple[Tensor, Tensor, Tensor] | list[Tensor] |
| required |
scale_factor | tuple[float, ...] | RoPE frequency scale per axis (t, h, w). | (1.0, 1.0, 1.0) |