Diffusers documentation

BriaTransformer2DModel

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

BriaTransformer2DModel

Bria에서 수정한 flux Transformer 모델

BriaTransformer2DModel

클래스 diffusers.BriaTransformer2DModel

< >

( 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 = 4096pooled_projection_dim: int = Noneguidance_embeds: bool = Falseaxes_dims_rope: list = [16, 56, 56]rope_theta = 10000time_theta = 10000 )

매개변수

  • patch_size (int) — 입력 데이터를 작은 패치로 변환할 때 사용할 패치 크기.
  • in_channels (int, 선택 사항, 기본값 16) — 입력의 채널 수입니다.
  • num_layers (int, 선택 사항, 기본값 18) — 사용할 MMDiT 블록의 레이어 수입니다.
  • num_single_layers (int, 선택 사항, 기본값 18) — 사용할 단일 DiT 블록의 레이어 수입니다.
  • attention_head_dim (int, 선택 사항, 기본값 64) — 각 헤드당 채널 수입니다.
  • num_attention_heads (int, 선택 사항, 기본값 18) — 멀티헤드 어텐션에 사용할 헤드의 수입니다.
  • joint_attention_dim (int, 선택 사항) — 사용할 encoder_hidden_states 차원의 수입니다.
  • pooled_projection_dim (int) — pooled_projections을 투사할 때 사용할 차원의 수.
  • guidance_embeds (bool, 기본값 False) — guidance embeddings를 사용할지 여부.

Flux에서 도입된 Transformer 모델입니다. FluxPipeline을 기반으로 몇 가지 변경 사항이 적용되었습니다:

forward

< >

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

매개변수

  • hidden_states (torch.FloatTensor, shape (batch size, channel, height, width)) — 입력 hidden_states.
  • encoder_hidden_states (torch.FloatTensor, shape (batch size, sequence_len, embed_dims)) — 사용할 조건 임베딩(프롬프트와 같은 입력 조건에서 계산된 임베딩).
  • pooled_projections (torch.FloatTensor, 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 블록의 잔차에 추가되는 텐서 목록입니다.
  • attention_kwargs (dict, 선택 사항) — 지정된 경우 diffusers.models.attention_processor의 self.processor에서 정의된 AttentionProcessor로 전달되는 kwargs 사전입니다.
  • return_dict (bool, 선택 사항, 기본값 True) — 단순 tuple 대신 ~models.transformer_2d.Transformer2DModelOutput를 반환할지 여부.

BriaTransformer2DModel의 forward 메서드입니다.

Update on GitHub