Buckets:

hf-doc-build/doc-dev / diffusers /pr_12249 /en /api /models /longcat_image_transformer2d.md
rtrm's picture
|
download
raw
2.96 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", torch_dtype=torch.bfloat16)

LongCatImageTransformer2DModel[[diffusers.LongCatImageTransformer2DModel]]

diffusers.LongCatImageTransformer2DModel[[diffusers.LongCatImageTransformer2DModel]]

Source

The Transformer model introduced in Longcat-Image.

forwarddiffusers.LongCatImageTransformer2DModel.forwardhttps://github.com/huggingface/diffusers/blob/vr_12249/src/diffusers/models/transformers/transformer_longcat_image.py#L464[{"name": "hidden_states", "val": ": Tensor"}, {"name": "encoder_hidden_states", "val": ": Tensor = None"}, {"name": "timestep", "val": ": LongTensor = None"}, {"name": "img_ids", "val": ": Tensor = None"}, {"name": "txt_ids", "val": ": Tensor = None"}, {"name": "guidance", "val": ": Tensor = None"}, {"name": "return_dict", "val": ": bool = True"}]- 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.
  • block_controlnet_hidden_states -- (list of torch.Tensor): A list of tensors that if specified are added to the residuals of transformer blocks.
  • return_dict (bool, optional, defaults to True) -- Whether or not to return a ~models.transformer_2d.Transformer2DModelOutput instead of a plain tuple.0If 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.

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.

block_controlnet_hidden_states : (list of torch.Tensor): A list of tensors that if specified are added to the residuals of transformer blocks.

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.

Xet Storage Details

Size:
2.96 kB
·
Xet hash:
8759e2efbe45dc1b359c509f44318f4dafd3380dcff734a758a05e68d5e9c367

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