Diffusers documentation

FluxTransformer2DModel

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

FluxTransformer2DModel

Flux의 이미지형 데이터용 Transformer 모델입니다.

FluxTransformer2DModel

클래스 diffusers.FluxTransformer2DModel

< >

( patch_size: int = 1in_channels: int = 64out_channels: int | None = Nonenum_layers: int = 19num_single_layers: int = 38attention_head_dim: int = 128num_attention_heads: int = 24joint_attention_dim: int = 4096pooled_projection_dim: int = 768guidance_embeds: bool = Falseaxes_dims_rope: tuple = (16, 56, 56) )

매개변수

  • patch_size (int, 기본값 1) — 입력 데이터를 작은 패치로 변환하기 위한 패치 크기.
  • in_channels (int, 기본값 64) — 입력의 채널 수입니다.
  • out_channels (int, 선택 사항, 기본값 None) — 출력의 채널 수입니다. 지정하지 않으면 기본값으로 in_channels가 사용됩니다.
  • num_layers (int, 기본값 19) — 사용할 dual stream DiT 블록의 레이어 수입니다.
  • num_single_layers (int, 기본값 38) — 사용할 단일 스트림 DiT 블록의 레이어 수입니다.
  • attention_head_dim (int, 기본값 128) — 각 attention head에 사용할 차원의 수입니다.
  • num_attention_heads (int, 기본값 24) — 사용할 attention head의 수입니다.
  • joint_attention_dim (int, 기본값 4096) — encoder_hidden_states의 임베딩/채널 차원)에 사용할 joint attention의 차원 수입니다.
  • pooled_projection_dim (int, 기본값 768) — 풀링된 투영에 사용할 차원의 수입니다.
  • guidance_embeds (bool, 기본값 False) — 모델의 guidance-distilled 변형에 guidance embeddings를 사용할지 여부입니다.
  • axes_dims_rope (tuple[int], 기본값 (16, 56, 56)) — 회전 위치 임베딩에 사용할 차원입니다.

Flux에 소개된 Transformer 모델.

참고: https://blackforestlabs.ai/announcing-black-forest-labs/

forward

< >

( hidden_states: Tensorencoder_hidden_states: Tensor = Nonepooled_projections: Tensor = Nonetimestep: LongTensor = Noneimg_ids: Tensor = Nonetxt_ids: Tensor = Noneguidance: Tensor = Nonejoint_attention_kwargs: dict[str, typing.Any] | None = Nonecontrolnet_block_samples = Nonecontrolnet_single_block_samples = Nonereturn_dict: bool = Truecontrolnet_blocks_repeat: bool = False )

매개변수

  • hidden_states (torch.Tensor, shape (batch_size, image_sequence_length, in_channels)) — 입력 hidden_states.
  • encoder_hidden_states (torch.Tensor, shape (batch_size, text_sequence_length, joint_attention_dim)) — 사용할 조건 임베딩(프롬프트와 같은 입력 조건에서 계산된 임베딩).
  • pooled_projections (torch.Tensor, shape (batch_size, projection_dim)) — 입력 조건의 임베딩에서 투영된 임베딩.
  • 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.
  • controlnet_block_samples (list of torch.Tensor, 선택 사항) — 지정된 경우 transformer 블록의 잔차에 추가되는 텐서 목록입니다.
  • controlnet_single_block_samples (list of torch.Tensor, 선택 사항) — 지정된 경우 단일 transformer 블록의 잔차에 추가되는 텐서 목록입니다.
  • controlnet_blocks_repeat (bool, 선택 사항, 기본값 False) — transformer 블록 전체에 걸쳐 controlnet 블록 샘플을 반복할지 여부입니다.
  • joint_attention_kwargs (dict, 선택 사항) — 지정된 경우 diffusers.models.attention_processor의 self.processor에서 정의된 AttentionProcessor로 전달되는 kwargs 사전입니다.
  • return_dict (bool, 선택 사항, 기본값 True) — 단순 tuple 대신 ~models.transformer_2d.Transformer2DModelOutput를 반환할지 여부.

FluxTransformer2DModel의 forward 메서드입니다.

Update on GitHub