Buckets:

hf-doc-build/doc-dev / diffusers /pr_14407 /en /api /models /longcat_image_transformer2d.md
|
download
raw
2.44 kB

LongCatImageTransformer2DModel

The model can be loaded with the following code snippet.

from diffusers import LongCatImageTransformer2DModel

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

LongCatImageTransformer2DModel[[diffusers.LongCatImageTransformer2DModel]]

diffusers.LongCatImageTransformer2DModel[[diffusers.LongCatImageTransformer2DModel]]

diffusers.LongCatImageTransformer2DModel(patch_size: int = 1, in_channels: int = 64, num_layers: int = 19, num_single_layers: int = 38, attention_head_dim: int = 128, num_attention_heads: int = 24, joint_attention_dim: int = 3584, pooled_projection_dim: int = 3584, axes_dims_rope: list = [16, 56, 56])

Source

The Transformer model introduced in Longcat-Image.

forward[[diffusers.LongCatImageTransformer2DModel.forward]]

forward(hidden_states: Tensor, encoder_hidden_states: Tensor = None, timestep: LongTensor = None, img_ids: Tensor = None, txt_ids: Tensor = None, guidance: Tensor = None, return_dict: bool = True)

Source

Parameters:

hidden_states (torch.FloatTensor of shape (batch size, channel, height, width)) : Input hidden_states.

encoder_hidden_states (torch.FloatTensor of shape (batch size, sequence_len, embed_dims)) : Conditional embeddings (embeddings computed from the input conditions such as prompts) to use.

timestep ( torch.LongTensor) : Used to indicate denoising step.

img_ids (torch.Tensor) : Image position ids used to compute the rotary positional embeddings.

txt_ids (torch.Tensor) : Text position ids used to compute the rotary positional embeddings.

guidance (torch.Tensor, optional) : Guidance scale embedding used for guidance-distilled variants of the model.

return_dict (bool, optional, defaults to True) : Whether or not to return a ~models.transformer_2d.Transformer2DModelOutput instead of a plain tuple.

Returns:

If return_dict is True, an ~models.transformer_2d.Transformer2DModelOutput is returned, otherwise a tuple where the first element is the sample tensor.

The forward method.

Xet Storage Details

Size:
2.44 kB
·
Xet hash:
fb3c2e1dac69bb3531ec76d959956283b6b85f3164566872e9aa2449e2dbd786

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.