Diffusers 文件
LatteTransformer3D模型
並獲得增強的文件體驗
開始使用
LatteTransformer3D模型
來自 Latte 的 3D 資料擴散 Transformer 模型。
LatteTransformer3D模型
類 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 )
前向傳播
< 源 >( 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 形狀
(批大小, 通道, 幀數, 高度, 寬度)
— 輸入hidden_states
。 - timestep (
torch.LongTensor
, 可選) — 用於指示去噪步長。可選時間步長將作為嵌入應用於AdaLayerNorm
。 - encoder_hidden_states (
torch.FloatTensor
形狀(批大小, 序列長度, 嵌入維度)
, 可選) — 用於交叉注意力層的條件嵌入。如果未給定,交叉注意力預設為自注意力。 - encoder_attention_mask (
torch.Tensor
, 可選) — 應用於encoder_hidden_states
的交叉注意力掩碼。支援兩種格式:- 掩碼
(批高度, 序列長度)
True = 保留,False = 丟棄。 - 偏置
(批高度, 1, 序列長度)
0 = 保留,-10000 = 丟棄。
如果
ndim == 2
:將被解釋為掩碼,然後轉換為與上述格式一致的偏置。此偏置將新增到交叉注意力分數中。 - 掩碼
- enable_temporal_attentions — (
bool
, 可選, 預設為True
): 是否啟用時間注意力。 - return_dict (
bool
, 可選, 預設為True
) — 是否返回~models.unet_2d_condition.UNet2DConditionOutput
而不是普通元組。
的 LatteTransformer3DModel 前向方法。