Diffusers documentation

BriaFibo2Transformer2DModel

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

BriaFibo2Transformer2DModel

BriaのFibo 2.0の単一ストリームtransformerは、Z-Imageブロックを基盤として構築されています。テキスト条件付けはQwen3-VLから2つの方法で得られます。1つ目は、Perceiver resamplerがテキストエンコーダーの隠れ状態をgistトークンに変換し、それらが画像トークンと同一のストリームを共有することです。2つ目は、5つのブロックが、自身のQwen3-VLレイヤーのバンドルに対してゲート付きクロスアテンションを追加することです。編集を行う場合、編集対象の画像の潜在変数がクリーンなトークンとしてストリームに結合され、各画像は独自のRoPEプレーン上で処理されます。

BriaFibo2Transformer2DModel

class diffusers.BriaFibo2Transformer2DModel

< >

( in_channels: int = 32patch_size: int = 2dim: int = 3584n_layers: int = 44n_refiner_layers: int = 2n_heads: int = 28norm_eps: float = 1e-05cap_feat_dim: int = 7680injection_layer_ids: tuple = (6, 14, 22, 30, 38)perceiver_num_layers: int = 2min_num_gist_tokens: int = 256max_num_gist_tokens: int = 512gist_step: int = 64gist_min_text_len: int = 256gist_max_text_len: int = 2048rope_theta: float = 256.0t_scale: float = 1000.0axes_dims: tuple = (32, 48, 48)axes_lens: tuple = (2048, 512, 512) )

forward

< >

( hidden_states: Tensortimestep: Tensorencoder_hidden_states: Tensorencoder_attention_mask: typing.Optional[torch.Tensor] = Nonecontext_latents: list[torch.Tensor] | None = Nonereturn_dict: bool = True ) → Transformer2DModelOutput or tuple

パラメータ

  • hidden_states (torch.Tensor、形状 (batch_size, in_channels, height, width)) — 生成対象の画像の正規化された VAE 潜在変数です。
  • timestep (torch.Tensor、shape (batch_size,)) — [0, 1] の範囲のノイズレベル: 1 が純粋なノイズ、0 がクリーンな画像です。
  • encoder_hidden_states (torch.Tensor、形状 (batch_size, 1 + len(injection_layer_ids), text_len, cap_feat_dim)) — テキストエンコーダーの特徴量: Perceiver のバンドルが先頭に来て、その後、各インジェクションブロックごとに1つのバンドルが続きます。
  • encoder_attention_mask (torch.Tensor、shape (batch_size, text_len)、任意) — 同一長さにパディングされたプロンプトのバッチにおいて、実際のテキストトークンを示す Bool マスクです。パディングがない場合は None のままにしてください。
  • context_latents (list[torch.Tensor], 任意) — 編集対象の画像の正規化された VAE 潜在変数。画像ごとに (batch_size, in_channels, height, width) の形状を持つテンソルが、順序どおりに含まれます。各画像は独自のサイズを持つことができます。これらのトークンはクリーンなトークンとして生成を条件付け、予測の対象にはなりません。
  • return_dict (bool、デフォルトはTrue) — タプルではなくTransformer2DModelOutputを返すかどうか。

戻り値

Transformer2DModelOutput または tuple

hidden_states と同じ形状を持つ予測速度。return_dict が False の場合、そのテンソルを最初の要素とするタプル。

Update on GitHub