r""" A conditional Spatio-Temporal UNet model that takes a noisy video frames, conditional state, and a timestep and returns a sample shaped output. This model inherits from [`ModelMixin`]. Check the superclass documentation for it's generic methods implemented for all models (such
| 31 | |
| 32 | |
| 33 | class UNetSpatioTemporalConditionModel(ModelMixin, ConfigMixin, UNet2DConditionLoadersMixin): |
| 34 | r""" |
| 35 | A conditional Spatio-Temporal UNet model that takes a noisy video frames, conditional state, |
| 36 | and a timestep and returns a sample shaped output. |
| 37 | |
| 38 | This model inherits from [`ModelMixin`]. Check the superclass documentation for it's generic methods implemented |
| 39 | for all models (such as downloading or saving). |
| 40 | |
| 41 | Parameters: |
| 42 | sample_size (`int` or `Tuple[int, int]`, *optional*, defaults to `None`): |
| 43 | Height and width of input/output sample. |
| 44 | in_channels (`int`, *optional*, defaults to 8): Number of channels in the input sample. |
| 45 | out_channels (`int`, *optional*, defaults to 4): Number of channels in the output. |
| 46 | down_block_types (`Tuple[str]`, *optional*, defaults to `("CrossAttnDownBlockSpatioTemporal", |
| 47 | "CrossAttnDownBlockSpatioTemporal", "CrossAttnDownBlockSpatioTemporal", "DownBlockSpatioTemporal")`): |
| 48 | The tuple of downsample blocks to use. |
| 49 | up_block_types (`Tuple[str]`, *optional*, defaults to `("UpBlockSpatioTemporal", |
| 50 | "CrossAttnUpBlockSpatioTemporal", "CrossAttnUpBlockSpatioTemporal", "CrossAttnUpBlockSpatioTemporal")`): |
| 51 | The tuple of upsample blocks to use. |
| 52 | block_out_channels (`Tuple[int]`, *optional*, defaults to `(320, 640, 1280, 1280)`): |
| 53 | The tuple of output channels for each block. |
| 54 | addition_time_embed_dim: (`int`, defaults to 256): |
| 55 | Dimension to to encode the additional time ids. |
| 56 | projection_class_embeddings_input_dim (`int`, defaults to 768): |
| 57 | The dimension of the projection of encoded `added_time_ids`. |
| 58 | layers_per_block (`int`, *optional*, defaults to 2): The number of layers per block. |
| 59 | cross_attention_dim (`int` or `Tuple[int]`, *optional*, defaults to 1280): |
| 60 | The dimension of the cross attention features. |
| 61 | transformer_layers_per_block (`int`, `Tuple[int]`, or `Tuple[Tuple]` , *optional*, defaults to 1): |
| 62 | The number of transformer blocks of type [`~models.attention.BasicTransformerBlock`]. Only relevant for |
| 63 | [`~models.unet_3d_blocks.CrossAttnDownBlockSpatioTemporal`], |
| 64 | [`~models.unet_3d_blocks.CrossAttnUpBlockSpatioTemporal`], |
| 65 | [`~models.unet_3d_blocks.UNetMidBlockSpatioTemporal`]. |
| 66 | num_attention_heads (`int`, `Tuple[int]`, defaults to `(5, 10, 10, 20)`): |
| 67 | The number of attention heads. |
| 68 | dropout (`float`, *optional*, defaults to 0.0): The dropout probability to use. |
| 69 | """ |
| 70 | |
| 71 | _supports_gradient_checkpointing = True |
| 72 | |
| 73 | @register_to_config |
| 74 | def __init__( |
| 75 | self, |
| 76 | sample_size: Optional[int] = None, |
| 77 | in_channels: int = 8, |
| 78 | out_channels: int = 4, |
| 79 | down_block_types: Tuple[str] = ( |
| 80 | "CrossAttnDownBlockSpatioTemporal", |
| 81 | "CrossAttnDownBlockSpatioTemporal", |
| 82 | "CrossAttnDownBlockSpatioTemporal", |
| 83 | "DownBlockSpatioTemporal", |
| 84 | ), |
| 85 | up_block_types: Tuple[str] = ( |
| 86 | "UpBlockSpatioTemporal", |
| 87 | "CrossAttnUpBlockSpatioTemporal", |
| 88 | "CrossAttnUpBlockSpatioTemporal", |
| 89 | "CrossAttnUpBlockSpatioTemporal", |
| 90 | ), |
nothing calls this directly
no outgoing calls
no test coverage detected