Diffusers documentation

AllegroTransformer3DModel

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

AllegroTransformer3DModel

Un modèle Diffusion Transformer pour des données 3D de Allegro a été introduit dans Allegro: Open the Black Box of Commercial-Level Video Generation Model par RhymesAI.

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

from diffusers import AllegroTransformer3DModel

transformer = AllegroTransformer3DModel.from_pretrained("rhymes-ai/Allegro", subfolder="transformer", dtype=torch.bfloat16).to("cuda")  # or "mps", "xpu", "cpu"

AllegroTransformer3DModel

classe diffusers.AllegroTransformer3DModel

< >

( patch_size: int = 2patch_size_t: int = 1num_attention_heads: int = 24attention_head_dim: int = 96in_channels: int = 4out_channels: int = 4num_layers: int = 32dropout: float = 0.0cross_attention_dim: int = 2304attention_bias: bool = Truesample_height: int = 90sample_width: int = 160sample_frames: int = 22activation_fn: str = 'gelu-approximate'norm_elementwise_affine: bool = Falsenorm_eps: float = 1e-06caption_channels: int = 4096interpolation_scale_h: float = 2.0interpolation_scale_w: float = 2.0interpolation_scale_t: float = 2.2 )

forward

< >

( hidden_states: Tensorencoder_hidden_states: Tensortimestep: LongTensorattention_mask: typing.Optional[torch.Tensor] = Noneencoder_attention_mask: typing.Optional[torch.Tensor] = Noneimage_rotary_emb: tuple[torch.Tensor, torch.Tensor] | None = Nonereturn_dict: bool = True )

Paramètres

  • hidden_states (torch.Tensor de forme (batch_size, num_channels, num_frames, height, width)) — hidden_states d'entrée.
  • encoder_hidden_states (torch.Tensor 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.
  • attention_mask (torch.Tensor, facultatif) — Masque d'auto-attention appliqué à hidden_states.
  • encoder_attention_mask (torch.Tensor, facultatif) — Masque d'attention croisée appliqué à encoder_hidden_states.
  • image_rotary_emb (tuple de torch.Tensor, facultatif) — Emplacements positionnels rotatifs précalculés.
  • 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 du AllegroTransformer3DModel.

Transformer2DModelOutput

classe diffusers.models.modeling_outputs.Transformer2DModelOutput

< >

( sample: torch.Tensor )

Paramètres

  • sample (torch.Tensor de forme (batch_size, num_channels, height, width) ou (batch size, num_vector_embeds - 1, num_latent_pixels) si Transformer2DModel est discret) — Les états cachés en sortie, conditionnés par l'entrée encoder_hidden_states. Si discret, renvoie les distributions de probabilité pour les pixels latents non bruités.

La sortie de Transformer2DModel.

Update on GitHub