class_docstr: Dual transformer wrapper that combines two `Transformer2DModel`s for mixed inference.
  
  Parameters:
      num_attention_heads (`int`, *optional*, defaults to 16): The number of heads to use for multi-head attention.
      attention_head_dim (`int`, *optional*, defaults to 88): The number of channels in each head.
      in_channels (`int`, *optional*):
          Pass if the input is continuous. The number of channels in the input and output.
      num_layers (`int`, *optional*, defaults to 1): The number of layers of Transformer blocks to use.
      dropout (`float`, *optional*, defaults to 0.1): The dropout probability to use.
      cross_attention_dim (`int`, *optional*): The number of encoder_hidden_states dimensions to use.
      sample_size (`int`, *optional*): Pass if the input is discrete. The width of the latent images.
          Note that this is fixed at training time as it is used for learning a number of position embeddings. See
          `ImagePositionalEmbeddings`.
      num_vector_embeds (`int`, *optional*):
          Pass if the input is discrete. The number of classes of the vector embeddings of the latent pixels.
          Includes the class for the masked latent pixel.
      activation_fn (`str`, *optional*, defaults to `"geglu"`): Activation function to be used in feed-forward.
      num_embeds_ada_norm ( `int`, *optional*): Pass if at least one of the norm_layers is `AdaLayerNorm`.
          The number of diffusion steps used during training. Note that this is fixed at training time as it is used
          to learn a number of embeddings that are added to the hidden states. During inference, you can denoise for
          up to but not more than steps than `num_embeds_ada_norm`.
      attention_bias (`bool`, *optional*):
          Configure if the TransformerBlocks' attention should contain a bias parameter.
class_docstr_tok: ["Dual","transformer","wrapper","that","combines","two","`","Transformer2DModel","`","s","for","mixed","inference",".","Parameters",":","num_attention_heads","(","`","int","`",",","*","optional","*",",","defaults","to","16",")",":","The","number","of","heads","to","use","for","multi-head","attention",".","attention_head_dim","(","`","int","`",",","*","optional","*",",","defaults","to","88",")",":","The","number","of","channels","in","each","head",".","in_channels","(","`","int","`",",","*","optional","*",")",":","Pass","if","the","input","is","continuous",".","The","number","of","channels","in","the","input","and","output",".","num_layers","(","`","int","`",",","*","optional","*",",","defaults","to","1",")",":","The","number","of","layers","of","Transformer","blocks","to","use",".","dropout","(","`","float","`",",","*","optional","*",",","defaults","to","0.1",")",":","The","dropout","probability","to","use",".","cross_attention_dim","(","`","int","`",",","*","optional","*",")",":","The","number","of","encoder_hidden_states","dimensions","to","use",".","sample_size","(","`","int","`",",","*","optional","*",")",":","Pass","if","the","input","is","discrete",".","The","width","of","the","latent","images",".","Note","that","this","is","fixed","at","training","time","as","it","is","used","for","learning","a","number","of","position","embeddings",".","See","`","ImagePositionalEmbeddings","`",".","num_vector_embeds","(","`","int","`",",","*","optional","*",")",":","Pass","if","the","input","is","discrete",".","The","number","of","classes","of","the","vector","embeddings","of","the","latent","pixels",".","Includes","the","class","for","the","masked","latent","pixel",".","activation_fn","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","geglu","''","`",")",":","Activation","function","to","be","used","in","feed-forward",".","num_embeds_ada_norm","(","`","int","`",",","*","optional","*",")",":","Pass","if","at","least","one","of","the","norm_layers","is","`","AdaLayerNorm","`",".","The","number","of","diffusion","steps","used","during","training",".","Note","that","this","is","fixed","at","training","time","as","it","is","used","to","learn","a","number","of","embeddings","that","are","added","to","the","hidden","states",".","During","inference",",","you","can","denoise","for","up","to","but","not","more","than","steps","than","`","num_embeds_ada_norm","`",".","attention_bias","(","`","bool","`",",","*","optional","*",")",":","Configure","if","the","TransformerBlocks","'","attention","should","contain","a","bias","parameter","."]
code: def __init__(
      self,
      num_attention_heads: int = 16,
      attention_head_dim: int = 88,
      in_channels: Optional[int] = None,
      num_layers: int = 1,
      dropout: float = 0.0,
      norm_num_groups: int = 32,
      cross_attention_dim: Optional[int] = None,
      attention_bias: bool = False,
      sample_size: Optional[int] = None,
      num_vector_embeds: Optional[int] = None,
      activation_fn: str = "geglu",
      num_embeds_ada_norm: Optional[int] = None,
  ):
      super().__init__()
      self.transformers = nn.ModuleList(
          [
              Transformer2DModel(
                  num_attention_heads=num_attention_heads,
                  attention_head_dim=attention_head_dim,
                  in_channels=in_channels,
                  num_layers=num_layers,
                  dropout=dropout,
                  norm_num_groups=norm_num_groups,
                  cross_attention_dim=cross_attention_dim,
                  attention_bias=attention_bias,
                  sample_size=sample_size,
                  num_vector_embeds=num_vector_embeds,
                  activation_fn=activation_fn,
                  num_embeds_ada_norm=num_embeds_ada_norm,
              )
              for _ in range(2)
          ]
      )
  
      # Variables that can be set by a pipeline:
  
      # The ratio of transformer1 to transformer2's output states to be combined during inference
      self.mix_ratio = 0.5
  
      # The shape of `encoder_hidden_states` is expected to be
      # `(batch_size, condition_lengths[0]+condition_lengths[1], num_features)`
      self.condition_lengths = [77, 257]
  
      # Which transformer to use to encode which condition.
      # E.g. `(1, 0)` means that we'll use `transformers[1](conditions[0])` and `transformers[0](conditions[1])`
      self.transformer_index_for_condition = [1, 0]
  
imports: from typing import Optional
  from torch import nn
  from .transformer_2d import Transformer2DModel, Transformer2DModelOutput
label_desc: Use image node_id 1 to create a new DualTransformer2DModel object from inherited base classes: nn with example: obj = DualTransformer2DModel(num_attention_heads, attention_head_dim, in_channels, num_layers, dropout, norm_num_groups, cross_attention_dim, attention_bias, sample_size, num_vector_embeds, activation_fn, num_embeds_ada_norm)