Diffusers 文档

LatteTransformer3D模型

Hugging Face's logo
加入 Hugging Face 社区

并获得增强的文档体验

开始使用

LatteTransformer3D模型

来自 Latte 的用于 3D 数据的扩散 Transformer 模型。

LatteTransformer3D模型

class diffusers.LatteTransformer3DModel

< >

( num_attention_heads: int = 16 attention_head_dim: int = 88 in_channels: typing.Optional[int] = None out_channels: typing.Optional[int] = None num_layers: int = 1 dropout: float = 0.0 cross_attention_dim: typing.Optional[int] = None attention_bias: bool = False sample_size: int = 64 patch_size: typing.Optional[int] = None activation_fn: str = 'geglu' num_embeds_ada_norm: typing.Optional[int] = None norm_type: str = 'layer_norm' norm_elementwise_affine: bool = True norm_eps: float = 1e-05 caption_channels: int = None video_length: int = 16 )

forward

< >

( hidden_states: Tensor timestep: typing.Optional[torch.LongTensor] = None encoder_hidden_states: typing.Optional[torch.Tensor] = None encoder_attention_mask: typing.Optional[torch.Tensor] = None enable_temporal_attentions: bool = True return_dict: bool = True )

参数

  • hidden_states 形状为 (batch size, channel, num_frame, height, width) — 输入 hidden_states
  • timestep ( torch.LongTensor, 可选) — 用于指示去噪步骤。可选的时间步,用作 AdaLayerNorm 中的嵌入。
  • encoder_hidden_states ( torch.FloatTensor,形状为 (batch size, sequence len, embed dims), 可选) — 交叉注意力层的条件嵌入。如果未给出,则交叉注意力默认为自注意力。
  • encoder_attention_mask ( torch.Tensor, 可选) — 应用于 encoder_hidden_states 的交叉注意力掩码。支持两种格式:

    • 掩码 (batcheight, sequence_length) True = 保留,False = 丢弃。
    • 偏差 (batcheight, 1, sequence_length) 0 = 保留,-10000 = 丢弃。

    如果 ndim == 2:将被解释为掩码,然后转换为与上述格式一致的偏差。此偏差将添加到交叉注意力分数中。

  • enable_temporal_attentions — (bool, 可选, 默认为 True): 是否启用时间注意力。
  • return_dict (bool, 可选, 默认为 True) — 是否返回 ~models.unet_2d_condition.UNet2DConditionOutput 而不是普通元组。

LatteTransformer3DModel 的 forward 方法。

< > 在 GitHub 上更新