Diffusers documentation
BriaFibo2Transformer2DModel
BriaFibo2Transformer2DModel
The single-stream transformer of Bria’s Fibo 2.0, built on the Z-Image block. Its text conditioning comes from Qwen3-VL in two ways: a Perceiver resampler turns the text encoder’s hidden states into gist tokens that share the stream with the image tokens, and five blocks add a gated cross-attention to their own bundle of Qwen3-VL layers. To edit, the latents of the images to edit join the stream as clean tokens, each image on its own RoPE plane.
BriaFibo2Transformer2DModel
class diffusers.BriaFibo2Transformer2DModel
< source >( 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
< source >( 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
Parameters
- hidden_states (
torch.Tensorof shape(batch_size, in_channels, height, width)) — Normalized VAE latents of the image being generated. - timestep (
torch.Tensorof shape(batch_size,)) — Noise level in[0, 1]: 1 is pure noise, 0 is a clean image. - encoder_hidden_states (
torch.Tensorof shape(batch_size, 1 + len(injection_layer_ids), text_len, cap_feat_dim)) — Text encoder features: the Perceiver’s bundle first, then one bundle per injection block. - encoder_attention_mask (
torch.Tensorof shape(batch_size, text_len), optional) — Bool mask of the real text tokens, for a batch of prompts padded to the same length. Leave it asNonewhen nothing is padded. - context_latents (
list[torch.Tensor], optional) — Normalized VAE latents of the images to edit, one tensor of shape(batch_size, in_channels, height, width)per image, in order. Each image can have its own size. Their tokens condition the generation as clean tokens and are not predicted. - return_dict (
bool, defaults toTrue) — Whether to return a Transformer2DModelOutput instead of a tuple.
Returns
Transformer2DModelOutput or tuple
The predicted velocity, with the shape of
hidden_states. If return_dict is False, a tuple whose first element is that tensor.