Diffusers 文件
EasyAnimateTransformer3DModel
並獲得增強的文件體驗
開始使用
EasyAnimateTransformer3DModel
EasyAnimate 是阿里巴巴 PAI 團隊引入的一個用於 3D 資料的 Diffusion Transformer 模型,可在 EasyAnimate 中找到。
該模型可以透過以下程式碼片段載入。
from diffusers import EasyAnimateTransformer3DModel
transformer = EasyAnimateTransformer3DModel.from_pretrained("alibaba-pai/EasyAnimateV5.1-12b-zh", subfolder="transformer", torch_dtype=torch.float16).to("cuda")
EasyAnimateTransformer3DModel
class diffusers.EasyAnimateTransformer3DModel
< 來源 >( num_attention_heads: int = 48 attention_head_dim: int = 64 in_channels: typing.Optional[int] = None out_channels: typing.Optional[int] = None patch_size: typing.Optional[int] = None sample_width: int = 90 sample_height: int = 60 activation_fn: str = 'gelu-approximate' timestep_activation_fn: str = 'silu' freq_shift: int = 0 num_layers: int = 48 mmdit_layers: int = 48 dropout: float = 0.0 time_embed_dim: int = 512 add_norm_text_encoder: bool = False text_embed_dim: int = 3584 text_embed_dim_t5: int = None norm_eps: float = 1e-05 norm_elementwise_affine: bool = True flip_sin_to_cos: bool = True time_position_encoding_type: str = '3d_rope' after_norm = False resize_inpaint_mask_directly: bool = True enable_text_attention_mask: bool = True add_noise_in_inpaint_model: bool = True )
引數
- num_attention_heads (
int
, 預設為48
) — 多頭注意力使用的頭數。 - attention_head_dim (
int
, 預設為64
) — 每個頭中的通道數。 - in_channels (
int
, 預設為16
) — 輸入中的通道數。 - out_channels (
int
, 可選, 預設為16
) — 輸出中的通道數。 - patch_size (
int
, 預設為2
) — 補丁嵌入層中使用的補丁大小。 - sample_width (
int
, 預設為90
) — 輸入潛在的寬度。 - sample_height (
int
, 預設為60
) — 輸入潛在的高度。 - activation_fn (
str
, 預設為"gelu-approximate"
) — 前饋網路中使用的啟用函式。 - timestep_activation_fn (
str
, 預設為"silu"
) — 生成時間步嵌入時使用的啟用函式。 - num_layers (
int
, 預設為30
) — 使用的 Transformer 塊層數。 - mmdit_layers (
int
, 預設為1000
) — 使用的多模態 Transformer 塊層數。 - dropout (
float
, 預設為0.0
) — 使用的 dropout 機率。 - time_embed_dim (
int
, 預設為512
) — 時間步嵌入的輸出維度。 - text_embed_dim (
int
, 預設為4096
) — 文字編碼器中文字嵌入的輸入維度。 - norm_eps (
float
, 預設為1e-5
) — 歸一化層中使用的 epsilon 值。 - norm_elementwise_affine (
bool
, 預設為True
) — 是否在歸一化層中使用逐元素仿射。 - flip_sin_to_cos (
bool
, 預設為True
) — 是否翻轉時間嵌入中的正弦到餘弦。 - time_position_encoding_type (
str
, 預設為3d_rope
) — 時間位置編碼的型別。 - after_norm (
bool
, 預設為False
) — 歸一化後應用的標誌。 - resize_inpaint_mask_directly (
bool
, 預設為True
) — 直接調整影像修復掩碼大小的標誌。 - enable_text_attention_mask (
bool
, 預設為True
) — 啟用文字注意力掩碼的標誌。 - add_noise_in_inpaint_model (
bool
, 預設為False
) — 在影像修復模型中新增噪聲的標誌。
EasyAnimate 中用於影片類資料的 Transformer 模型。
Transformer2DModelOutput
class diffusers.models.modeling_outputs.Transformer2DModelOutput
< 來源 >( sample: torch.Tensor )
引數
- sample (
torch.Tensor
,形狀為(batch_size, num_channels, height, width)
或(batch size, num_vector_embeds - 1, num_latent_pixels)
如果 Transformer2DModel 是離散的) — 在encoder_hidden_states
輸入上條件化的隱藏狀態輸出。如果是離散的,則返回未加噪的潛在畫素的機率分佈。
Transformer2DModel 的輸出。