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

다음 코드 스니펫으로 모델을 로드할 수 있습니다.

from diffusers import LongCatImageTransformer2DModel

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

LongCatImageTransformer2DModel

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

Longcat-Image에 소개된 Transformer 모델.

forward

< >

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

매개변수

  • hidden_states (torch.FloatTensor, shape (batch size, channel, height, width)) — 입력 hidden_states.
  • encoder_hidden_states (torch.FloatTensor, shape (batch size, sequence_len, embed_dims)) — 사용할 조건 임베딩(프롬프트와 같은 입력 조건에서 계산된 임베딩).
  • timestep ( torch.LongTensor) — 디노이징 단계를 나타내는 데 사용됩니다.
  • img_ids (torch.Tensor) — 회전 위치 임베딩을 계산하는 데 사용되는 이미지 위치 id입니다.
  • txt_ids (torch.Tensor) — 회전 위치 임베딩을 계산하는 데 사용되는 텍스트 위치 id입니다.
  • guidance (torch.Tensor, optional) — Guidance scale embedding used for guidance-distilled variants of the model.
  • return_dict (bool, 선택 사항, 기본값 True) — 단순 tuple 대신 ~models.transformer_2d.Transformer2DModelOutput를 반환할지 여부.

forward 메서드입니다.

Update on GitHub