Diffusers documentation

BriaFiboTransformer2DModel

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

BriaFiboTransformer2DModel

来自 Bria 的改进版 flux Transformer 模型

BriaFiboTransformer2DModel

类 diffusers.BriaFiboTransformer2DModel

< >

( patch_size: int = 1in_channels: int = 64num_layers: int = 19num_single_layers: int = 38attention_head_dim: int = 128num_attention_heads: int = 24joint_attention_dim: int = 4096pooled_projection_dim: int = Noneguidance_embeds: bool = Falseaxes_dims_rope: list[int] = [16, 56, 56]rope_theta = 10000time_theta = 10000text_encoder_dim: int = 2048 )

参数

  • patch_size (int) — 用于将输入数据划分为小块的块大小。
  • in_channels (int,可选,默认为 16) — 输入中的通道数。
  • num_layers (int,可选,默认为 18) — 要使用的 MMDiT 块层数。
  • num_single_layers (int,可选,默认为 18) — 要使用的单层 DiT 块的数量。
  • attention_head_dim (int,可选,默认为 64) — 每个注意力头中的通道数。
  • num_attention_heads (int,可选,默认为 18) — 多头注意力机制中使用的注意力头数量。
  • joint_attention_dim (int,可选) — 要使用的 encoder_hidden_states 维度数量。
  • pooled_projection_dim (int) — 用于投影 pooled_projections 的维度数。
  • guidance_embeds(bool,默认为 False)—— 是否使用 guidance embeddings。
  • … —

forward

< >

( hidden_states: Tensorencoder_hidden_states: Tensor = Nonetext_encoder_layers: list = Nonepooled_projections: Tensor = Nonetimestep: LongTensor = Noneimg_ids: Tensor = Nonetxt_ids: Tensor = Noneguidance: Tensor = Nonejoint_attention_kwargs: dict[str, typing.Any] | None = Nonereturn_dict: bool = True )

参数

  • hidden_states(形状为 (batch size, channel, height, width) 的 torch.FloatTensor)— 输入的 hidden_states。
  • encoder_hidden_states (torch.FloatTensor,形状为 (batch size, sequence_len, embed_dims)) — 要使用的条件嵌入(由输入条件(例如提示词)计算得出的嵌入)。
  • text_encoder_layers (list of torch.Tensor) — 每个 Transformer 块对应的文本编码器隐藏状态,每个块一个张量。
  • pooled_projections(形状为 (batch_size, projection_dim) 的 torch.FloatTensor)— 由输入条件的嵌入投影得到的嵌入。
  • timestep ( torch.LongTensor) — 用于指示去噪步骤。
  • img_ids (torch.Tensor) — 用于计算旋转位置嵌入的图像位置 ID。
  • txt_ids (torch.Tensor) — 用于计算旋转位置嵌入的文本位置 ID。
  • guidance (torch.Tensor, 可选) — 用于模型引导蒸馏变体的引导尺度嵌入。
  • joint_attention_kwargs (dict, 可选) — 一个 kwargs 字典,如果指定,将作为参数传递给 diffusers.models.attention_processor 中 self.processor 下定义的 AttentionProcessor。
  • return_dict (bool,可选,默认为 True) — 是否返回 ~models.transformer_2d.Transformer2DModelOutput 而不是普通的元组。
Update on GitHub