Buckets:
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]]
The Transformer model introduced in Longcat-Image.
forwarddiffusers.LongCatImageTransformer2DModel.forwardhttps://github.com/huggingface/diffusers/blob/vr_11739/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.FloatTensorof 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 -- (
listoftorch.Tensor): A list of tensors that if specified are added to the residuals of transformer blocks. - return_dict (
bool, optional, defaults toTrue) -- Whether or not to return a~models.transformer_2d.Transformer2DModelOutputinstead of a plain tuple.0Ifreturn_dictis True, an~models.transformer_2d.Transformer2DModelOutputis returned, otherwise atuplewhere 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:
- a11c8f83dc9fe677e5acceeb8af46c7a8c54def9e76da253f11eaad19fd1107a
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.