A ControlNet model. Args: in_channels (`int`, defaults to 4): The number of channels in the input sample. flip_sin_to_cos (`bool`, defaults to `True`): Whether to flip the sin to cos in the time embedding. freq_shift (`int`, defaults to 0):
| 109 | |
| 110 | |
| 111 | class ControlNetModel(ModelMixin, ConfigMixin, FromOriginalModelMixin): |
| 112 | """ |
| 113 | A ControlNet model. |
| 114 | |
| 115 | Args: |
| 116 | in_channels (`int`, defaults to 4): |
| 117 | The number of channels in the input sample. |
| 118 | flip_sin_to_cos (`bool`, defaults to `True`): |
| 119 | Whether to flip the sin to cos in the time embedding. |
| 120 | freq_shift (`int`, defaults to 0): |
| 121 | The frequency shift to apply to the time embedding. |
| 122 | down_block_types (`tuple[str]`, defaults to `("CrossAttnDownBlock2D", "CrossAttnDownBlock2D", "CrossAttnDownBlock2D", "DownBlock2D")`): |
| 123 | The tuple of downsample blocks to use. |
| 124 | only_cross_attention (`Union[bool, Tuple[bool]]`, defaults to `False`): |
| 125 | block_out_channels (`tuple[int]`, defaults to `(320, 640, 1280, 1280)`): |
| 126 | The tuple of output channels for each block. |
| 127 | layers_per_block (`int`, defaults to 2): |
| 128 | The number of layers per block. |
| 129 | downsample_padding (`int`, defaults to 1): |
| 130 | The padding to use for the downsampling convolution. |
| 131 | mid_block_scale_factor (`float`, defaults to 1): |
| 132 | The scale factor to use for the mid block. |
| 133 | act_fn (`str`, defaults to "silu"): |
| 134 | The activation function to use. |
| 135 | norm_num_groups (`int`, *optional*, defaults to 32): |
| 136 | The number of groups to use for the normalization. If None, normalization and activation layers is skipped |
| 137 | in post-processing. |
| 138 | norm_eps (`float`, defaults to 1e-5): |
| 139 | The epsilon to use for the normalization. |
| 140 | cross_attention_dim (`int`, defaults to 1280): |
| 141 | The dimension of the cross attention features. |
| 142 | transformer_layers_per_block (`int` or `Tuple[int]`, *optional*, defaults to 1): |
| 143 | The number of transformer blocks of type [`~models.attention.BasicTransformerBlock`]. Only relevant for |
| 144 | [`~models.unet_2d_blocks.CrossAttnDownBlock2D`], [`~models.unet_2d_blocks.CrossAttnUpBlock2D`], |
| 145 | [`~models.unet_2d_blocks.UNetMidBlock2DCrossAttn`]. |
| 146 | encoder_hid_dim (`int`, *optional*, defaults to None): |
| 147 | If `encoder_hid_dim_type` is defined, `encoder_hidden_states` will be projected from `encoder_hid_dim` |
| 148 | dimension to `cross_attention_dim`. |
| 149 | encoder_hid_dim_type (`str`, *optional*, defaults to `None`): |
| 150 | If given, the `encoder_hidden_states` and potentially other embeddings are down-projected to text |
| 151 | embeddings of dimension `cross_attention` according to `encoder_hid_dim_type`. |
| 152 | attention_head_dim (`Union[int, Tuple[int]]`, defaults to 8): |
| 153 | The dimension of the attention heads. |
| 154 | use_linear_projection (`bool`, defaults to `False`): |
| 155 | class_embed_type (`str`, *optional*, defaults to `None`): |
| 156 | The type of class embedding to use which is ultimately summed with the time embeddings. Choose from None, |
| 157 | `"timestep"`, `"identity"`, `"projection"`, or `"simple_projection"`. |
| 158 | addition_embed_type (`str`, *optional*, defaults to `None`): |
| 159 | Configures an optional embedding which will be summed with the time embeddings. Choose from `None` or |
| 160 | "text". "text" will use the `TextTimeEmbedding` layer. |
| 161 | num_class_embeds (`int`, *optional*, defaults to 0): |
| 162 | Input dimension of the learnable embedding matrix to be projected to `time_embed_dim`, when performing |
| 163 | class conditioning with `class_embed_type` equal to `None`. |
| 164 | upcast_attention (`bool`, defaults to `False`): |
| 165 | resnet_time_scale_shift (`str`, defaults to `"default"`): |
| 166 | Time scale shift config for ResNet blocks (see `ResnetBlock2D`). Choose from `default` or `scale_shift`. |
| 167 | projection_class_embeddings_input_dim (`int`, *optional*, defaults to `None`): |
| 168 | The dimension of the `class_labels` input when `class_embed_type="projection"`. Required when |
no outgoing calls