text stringlengths 0 5.54k |
|---|
over each tensor of dim=dim. dim (int, optional, defaults to 0) β |
The dimension over which the feed-forward computation should be chunked. Choose between dim=0 (batch) |
or dim=1 (sequence length). Sets the attention processor to use feed forward |
chunking. enable_freeu < source > ( s1 s2 b1 b2 ) Parameters s1 (float) β |
Scaling factor for stage 1 to attenuate the contributions of the skip features. This is done to |
mitigate the βoversmoothing effectβ in the enhanced denoising process. s2 (float) β |
Scaling factor for stage 2 to attenuate the contributions of the skip features. This is done to |
mitigate the βoversmoothing effectβ in the enhanced denoising process. b1 (float) β Scaling factor for stage 1 to amplify the contributions of backbone features. b2 (float) β Scaling factor for stage 2 to amplify the contributions of backbone features. Enables the FreeU mechanism from https://arxiv.org/abs/2309.... |
are known to work well for different pipelines such as Stable Diffusion v1, v2, and Stable Diffusion XL. forward < source > ( sample: FloatTensor timestep: Union encoder_hidden_states: Tensor class_labels: Optional = None timestep_cond: Optional = None attention_mask: Optional = None cross_attention_kwargs: Optional ... |
The noisy input tensor with the following shape (batch, num_channels, num_frames, height, width. timestep (torch.FloatTensor or float or int) β The number of timesteps to denoise an input. encoder_hidden_states (torch.FloatTensor) β |
The encoder hidden states with shape (batch, sequence_length, feature_dim). class_labels (torch.Tensor, optional, defaults to None) β |
Optional class labels for conditioning. Their embeddings will be summed with the timestep embeddings. |
timestep_cond β (torch.Tensor, optional, defaults to None): |
Conditional embeddings for timestep. If provided, the embeddings will be summed with the samples passed |
through the self.time_embedding layer to obtain the timestep embeddings. attention_mask (torch.Tensor, optional, defaults to None) β |
An attention mask of shape (batch, key_tokens) is applied to encoder_hidden_states. If 1 the mask |
is kept, otherwise if 0 it is discarded. Mask will be converted into a bias, which adds large |
negative values to the attention scores corresponding to βdiscardβ tokens. cross_attention_kwargs (dict, optional) β |
A kwargs dictionary that if specified is passed along to the AttentionProcessor as defined under |
self.processor in |
diffusers.models.attention_processor. |
down_block_additional_residuals β (tuple of torch.Tensor, optional): |
A tuple of tensors that if specified are added to the residuals of down unet blocks. |
mid_block_additional_residual β (torch.Tensor, optional): |
A tensor that if specified is added to the residual of the middle unet block. return_dict (bool, optional, defaults to True) β |
Whether or not to return a ~models.unet_3d_condition.UNet3DConditionOutput instead of a plain |
tuple. cross_attention_kwargs (dict, optional) β |
A kwargs dictionary that if specified is passed along to the AttnProcessor. Returns |
~models.unet_3d_condition.UNet3DConditionOutput or tuple |
If return_dict is True, an ~models.unet_3d_condition.UNet3DConditionOutput is returned, otherwise |
a tuple is returned where the first element is the sample tensor. |
The UNet3DConditionModel forward method. fuse_qkv_projections < source > ( ) Enables fused QKV projections. For self-attention modules, all projection matrices (i.e., query, |
key, value) are fused. For cross-attention modules, key and value projection matrices are fused. This API is π§ͺ experimental. set_attention_slice < source > ( slice_size: Union ) Parameters slice_size (str or int or list(int), optional, defaults to "auto") β |
When "auto", input to the attention heads is halved, so attention is computed in two steps. If |
"max", maximum amount of memory is saved by running only one slice at a time. If a number is |
provided, uses as many slices as attention_head_dim // slice_size. In this case, attention_head_dim |
must be a multiple of slice_size. Enable sliced attention computation. When this option is enabled, the attention module splits the input tensor in slices to compute attention in |
several steps. This is useful for saving some memory in exchange for a small decrease in speed. set_attn_processor < source > ( processor: Union ) Parameters processor (dict of AttentionProcessor or only AttentionProcessor) β |
The instantiated processor class or a dictionary of processor classes that will be set as the processor |
for all Attention layers. |
If processor is a dict, the key needs to define the path to the corresponding cross attention |
processor. This is strongly recommended when setting trainable attention processors. Sets the attention processor to use to compute attention. set_default_attn_processor < source > ( ) Disables custom attention processors and sets the default attention implementation. unfuse_qkv_projections < source > ( ) ... |
The hidden states output conditioned on encoder_hidden_states input. Output of last layer of model. The output of UNet3DConditionModel. |
UNet2DConditionModel The UNet model was originally introduced by Ronneberger et al. for biomedical image segmentation, but it is also commonly used in π€ Diffusers because it outputs images that are the same size as the input. It is one of the most important components of a diffusion system because it facilitates the a... |
Height and width of input/output sample. in_channels (int, optional, defaults to 4) β Number of channels in the input sample. out_channels (int, optional, defaults to 4) β Number of channels in the output. center_input_sample (bool, optional, defaults to False) β Whether to center the input sample. flip_sin_to_... |
Whether to flip the sin to cos in the time embedding. freq_shift (int, optional, defaults to 0) β The frequency shift to apply to the time embedding. down_block_types (Tuple[str], optional, defaults to ("CrossAttnDownBlock2D", "CrossAttnDownBlock2D", "CrossAttnDownBlock2D", "DownBlock2D")) β |
The tuple of downsample blocks to use. mid_block_type (str, optional, defaults to "UNetMidBlock2DCrossAttn") β |
Block type for middle of UNet, it can be one of UNetMidBlock2DCrossAttn, UNetMidBlock2D, or |
UNetMidBlock2DSimpleCrossAttn. If None, the mid block layer is skipped. up_block_types (Tuple[str], optional, defaults to ("UpBlock2D", "CrossAttnUpBlock2D", "CrossAttnUpBlock2D", "CrossAttnUpBlock2D")) β |
The tuple of upsample blocks to use. only_cross_attention(bool or Tuple[bool], optional, default to False) β |
Whether to include self-attention in the basic transformer blocks, see |
BasicTransformerBlock. block_out_channels (Tuple[int], optional, defaults to (320, 640, 1280, 1280)) β |
The tuple of output channels for each block. layers_per_block (int, optional, defaults to 2) β The number of layers per block. downsample_padding (int, optional, defaults to 1) β The padding to use for the downsampling convolution. mid_block_scale_factor (float, optional, defaults to 1.0) β The scale factor to us... |
If None, normalization and activation layers is skipped in post-processing. norm_eps (float, optional, defaults to 1e-5) β The epsilon to use for the normalization. cross_attention_dim (int or Tuple[int], optional, defaults to 1280) β |
The dimension of the cross attention features. transformer_layers_per_block (int, Tuple[int], or Tuple[Tuple] , optional, defaults to 1) β |
The number of transformer blocks of type BasicTransformerBlock. Only relevant for |
CrossAttnDownBlock2D, CrossAttnUpBlock2D, |
UNetMidBlock2DCrossAttn. A conditional 2D UNet model that takes a noisy sample, 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 as downloading or saving). reverse_transformer_layers_per_block : (Tuple[Tuple], optional, defaults to None): |
The number of transformer blocks of type BasicTransformerBlock, in the upsampling |
blocks of the U-Net. Only relevant if transformer_layers_per_block is of type Tuple[Tuple] and for |
CrossAttnDownBlock2D, CrossAttnUpBlock2D, |
UNetMidBlock2DCrossAttn. |
encoder_hid_dim (int, optional, defaults to None): |
If encoder_hid_dim_type is defined, encoder_hidden_states will be projected from encoder_hid_dim |
dimension to cross_attention_dim. |
encoder_hid_dim_type (str, optional, defaults to None): |
If given, the encoder_hidden_states and potentially other embeddings are down-projected to text |
embeddings of dimension cross_attention according to encoder_hid_dim_type. |
attention_head_dim (int, optional, defaults to 8): The dimension of the attention heads. |
num_attention_heads (int, optional): |
The number of attention heads. If not defined, defaults to attention_head_dim |
resnet_time_scale_shift (str, optional, defaults to "default"): Time scale shift config |
for ResNet blocks (see ResnetBlock2D). Choose from default or scale_shift. |
class_embed_type (str, optional, defaults to None): |
The type of class embedding to use which is ultimately summed with the time embeddings. Choose from None, |
"timestep", "identity", "projection", or "simple_projection". |
addition_embed_type (str, optional, defaults to None): |
Configures an optional embedding which will be summed with the time embeddings. Choose from None or |
βtextβ. βtextβ will use the TextTimeEmbedding layer. |
addition_time_embed_dim: (int, optional, defaults to None): |
Dimension for the timestep embeddings. |
num_class_embeds (int, optional, defaults to None): |
Input dimension of the learnable embedding matrix to be projected to time_embed_dim, when performing |
class conditioning with class_embed_type equal to None. |
time_embedding_type (str, optional, defaults to positional): |
The type of position embedding to use for timesteps. Choose from positional or fourier. |
time_embedding_dim (int, optional, defaults to None): |
An optional override for the dimension of the projected time embedding. |
time_embedding_act_fn (str, optional, defaults to None): |
Optional activation function to use only once on the time embeddings before they are passed to the rest of |
the UNet. Choose from silu, mish, gelu, and swish. |
timestep_post_act (str, optional, defaults to None): |
The second activation function to use in timestep embedding. Choose from silu, mish and gelu. |
time_cond_proj_dim (int, optional, defaults to None): |
The dimension of cond_proj layer in the timestep embedding. |
conv_in_kernel (int, optional, default to 3): The kernel size of conv_in layer. conv_out_kernel (int, |
optional, default to 3): The kernel size of conv_out layer. projection_class_embeddings_input_dim (int, |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.