Diffusers documentation

LongCatImageTransformer2DModel

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v0.42.1).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

LongCatImageTransformer2DModel

モデルは、以下のコードスニペットで読み込むことができます。

from diffusers import LongCatImageTransformer2DModel

transformer = LongCatImageTransformer2DModel.from_pretrained("meituan-longcat/LongCat-Image ", subfolder="transformer", dtype=torch.bfloat16)

LongCatImageTransformer2DModel

class diffusers.LongCatImageTransformer2DModel

< >

( 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 = 3584pooled_projection_dim: int = 3584axes_dims_rope: list = [16, 56, 56] )

Longcat-Image で導入された Transformer モデル。

forward

< >

( hidden_states: Tensorencoder_hidden_states: Tensor = Nonetimestep: LongTensor = Noneimg_ids: Tensor = Nonetxt_ids: Tensor = Noneguidance: Tensor = Nonereturn_dict: bool = True )

パラメータ

  • hidden_states (torch.FloatTensor、形状 (batch size, channel, height, width)) — 入力となる hidden_states。
  • encoder_hidden_states (torch.FloatTensor、shape (batch size, sequence_len, embed_dims)) — 使用する条件埋め込み(プロンプトなどの入力条件から計算される埋め込み)。
  • timestep ( torch.LongTensor) — デノイジングステップを示すために使用されます。
  • img_ids (torch.Tensor) — 回転位置埋め込みを計算するために使用される画像の位置 ID。
  • txt_ids (torch.Tensor) — 回転位置埋め込みを計算するために使用されるテキストの位置 ID。
  • guidance (torch.Tensor、任意) — モデルのガイダンス蒸留版で使用するガイダンススケール埋め込み。
  • return_dict (bool、任意、デフォルトは True) — プレーンなタプルではなく ~models.transformer_2d.Transformer2DModelOutput を返すかどうか。

forwardメソッド。

Update on GitHub