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

Le modèle peut être chargé à l'aide du fragment de code suivant.

from diffusers import LongCatImageTransformer2DModel

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

LongCatImageTransformer2DModel

classe 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] )

Le modèle Transformer introduit dans Longcat-Image.

forward

< >

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

Paramètres

  • hidden_states (torch.FloatTensor de forme (batch size, channel, height, width)) — hidden_states d'entrée.
  • encoder_hidden_states (torch.FloatTensor de forme (batch size, sequence_len, embed_dims)) — Embeddings conditionnels (embeddings calculés à partir des conditions d’entrée telles que les prompts) à utiliser.
  • timestep ( torch.LongTensor) — Utilisé pour indiquer l'étape de débruitage.
  • img_ids (torch.Tensor) — Identifiants de position des images utilisés pour calculer les embeddings positionnels rotatifs.
  • txt_ids (torch.Tensor) — Identifiants de position du texte utilisés pour calculer les embeddings positionnels rotatifs.
  • guidance (torch.Tensor, optional) — Guidance scale embedding used for guidance-distilled variants of the model.
  • return_dict (bool, facultatif, par défaut True) — Indique s'il faut retourner un ~models.transformer_2d.Transformer2DModelOutput plutôt qu'un simple tuple.

La méthode forward.

Update on GitHub