kandinsky5 ¶
Classes¶
fastvideo.pipelines.stages.kandinsky5.Kandinsky5DenoisingStage ¶
Bases: PipelineStage
Source code in fastvideo/pipelines/stages/kandinsky5.py
Methods:¶
fastvideo.pipelines.stages.kandinsky5.Kandinsky5DenoisingStage.fast_sta_nabla staticmethod ¶
fast_sta_nabla(T: int, H: int, W: int, wT: int = 3, wH: int = 3, wW: int = 3, device: device | str = 'cuda') -> Tensor
Create a sparse temporal attention (STA) mask for efficient video generation.
This method generates a mask that limits attention to nearby frames and spatial positions, reducing computational complexity for video generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
T | int | Number of temporal frames | required |
H | int | Height in latent space | required |
W | int | Width in latent space | required |
wT | int | Temporal attention window size | 3 |
wH | int | Height attention window size | 3 |
wW | int | Width attention window size | 3 |
device | str | Device to create tensor on | 'cuda' |
Returns:
| Type | Description |
|---|---|
Tensor | torch.Tensor: Sparse attention mask of shape (THW, THW) |
Source code in fastvideo/pipelines/stages/kandinsky5.py
fastvideo.pipelines.stages.kandinsky5.Kandinsky5DenoisingStage.get_sparse_params ¶
Generate sparse attention parameters for the transformer based on sample dimensions.
This method computes the sparse attention configuration needed for efficient video processing in the transformer model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sample | Tensor | Input sample tensor | required |
device | device | Device to place tensors on | required |
Returns:
| Name | Type | Description |
|---|---|---|
Dict | dict[str, Any] | None | Dictionary containing sparse attention parameters |
Source code in fastvideo/pipelines/stages/kandinsky5.py
fastvideo.pipelines.stages.kandinsky5.Kandinsky5ImageEncodingStage ¶
Kandinsky5ImageEncodingStage(vae: ParallelTiledVAE, pipeline=None)
Bases: EncodingStage
Encode the conditioning image into a VAE latent for I2V.