Skip to content

Commit 84e1657

Browse files
galbriasayakpaul
andauthored
Bria fibo (huggingface#12545)
* Bria FIBO pipeline * style fixs * fix CR * Refactor BriaFibo classes and update pipeline parameters - Updated BriaFiboAttnProcessor and BriaFiboAttention classes to reflect changes from Flux equivalents. - Modified the _unpack_latents method in BriaFiboPipeline to improve clarity. - Increased the default max_sequence_length to 3000 and added a new optional parameter do_patching. - Cleaned up test_pipeline_bria_fibo.py by removing unused imports and skipping unsupported tests. * edit the docs of FIBO * Remove unused BriaFibo imports and update CPU offload method in BriaFiboPipeline * Refactor FIBO classes to BriaFibo naming convention - Updated class names from FIBO to BriaFibo for consistency across the module. - Modified instances of FIBOEmbedND, FIBOTimesteps, TextProjection, and TimestepProjEmbeddings to reflect the new naming. - Ensured all references in the BriaFiboTransformer2DModel are updated accordingly. * Add BriaFiboTransformer2DModel import to transformers module * Remove unused BriaFibo imports from modular pipelines and add BriaFiboTransformer2DModel and BriaFiboPipeline classes to dummy objects for enhanced compatibility with torch and transformers. * Update BriaFibo classes with copied documentation and fix import typo in pipeline module - Added documentation comments indicating the source of copied code in BriaFiboTransformerBlock and _pack_latents methods. - Corrected the import statement for BriaFiboPipeline in the pipelines module. * Remove unused BriaFibo imports from __init__.py to streamline modular pipelines. * Refactor documentation comments in BriaFibo classes to indicate inspiration from existing implementations - Updated comments in BriaFiboAttnProcessor, BriaFiboAttention, and BriaFiboPipeline to reflect that the code is inspired by other modules rather than copied. - Enhanced clarity on the origins of the methods to maintain proper attribution. * change Inspired by to Based on * add reference link and fix trailing whitespace * Add BriaFiboTransformer2DModel documentation and update comments in BriaFibo classes - Introduced a new documentation file for BriaFiboTransformer2DModel. - Updated comments in BriaFiboAttnProcessor, BriaFiboAttention, and BriaFiboPipeline to clarify the origins of the code, indicating copied sources for better attribution. --------- Co-authored-by: sayakpaul <[email protected]>
1 parent 55d49d4 commit 84e1657

File tree

16 files changed

+1897
-0
lines changed

16 files changed

+1897
-0
lines changed

docs/source/en/_toctree.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,8 @@
323323
title: AllegroTransformer3DModel
324324
- local: api/models/aura_flow_transformer2d
325325
title: AuraFlowTransformer2DModel
326+
- local: api/models/transformer_bria_fibo
327+
title: BriaFiboTransformer2DModel
326328
- local: api/models/bria_transformer
327329
title: BriaTransformer2DModel
328330
- local: api/models/chroma_transformer
@@ -469,6 +471,8 @@
469471
title: BLIP-Diffusion
470472
- local: api/pipelines/bria_3_2
471473
title: Bria 3.2
474+
- local: api/pipelines/bria_fibo
475+
title: Bria Fibo
472476
- local: api/pipelines/chroma
473477
title: Chroma
474478
- local: api/pipelines/cogview3
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!--Copyright 2025 The HuggingFace Team. All rights reserved.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
4+
the License. You may obtain a copy of the License at
5+
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
8+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
9+
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
10+
specific language governing permissions and limitations under the License.
11+
-->
12+
13+
# BriaFiboTransformer2DModel
14+
15+
A modified flux Transformer model from [Bria](https://huggingface.co/briaai/FIBO)
16+
17+
## BriaFiboTransformer2DModel
18+
19+
[[autodoc]] BriaFiboTransformer2DModel
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!--Copyright 2025 The HuggingFace Team. All rights reserved.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
4+
the License. You may obtain a copy of the License at
5+
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
8+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
9+
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
10+
specific language governing permissions and limitations under the License.
11+
-->
12+
13+
# Bria Fibo
14+
15+
Text-to-image models have mastered imagination - but not control. FIBO changes that.
16+
17+
FIBO is trained on structured JSON captions up to 1,000+ words and designed to understand and control different visual parameters such as lighting, composition, color, and camera settings, enabling precise and reproducible outputs.
18+
19+
With only 8 billion parameters, FIBO provides a new level of image quality, prompt adherence and proffesional control.
20+
21+
FIBO is trained exclusively on a structured prompt and will not work with freeform text prompts.
22+
you can use the [FIBO-VLM-prompt-to-JSON](https://huggingface.co/briaai/FIBO-VLM-prompt-to-JSON) model or the [FIBO-gemini-prompt-to-JSON](https://huggingface.co/briaai/FIBO-gemini-prompt-to-JSON) to convert your freeform text prompt to a structured JSON prompt.
23+
24+
its not recommended to use freeform text prompts directly with FIBO, as it will not produce the best results.
25+
26+
you can learn more about FIBO in [Bria Fibo Hugging Face page](https://huggingface.co/briaai/FIBO).
27+
28+
29+
## Usage
30+
31+
_As the model is gated, before using it with diffusers you first need to go to the [Bria Fibo Hugging Face page](https://huggingface.co/briaai/FIBO), fill in the form and accept the gate. Once you are in, you need to login so that your system knows you’ve accepted the gate._
32+
33+
Use the command below to log in:
34+
35+
```bash
36+
hf auth login
37+
```
38+
39+
40+
## BriaPipeline
41+
42+
[[autodoc]] BriaPipeline
43+
- all
44+
- __call__
45+

src/diffusers/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@
198198
"AutoencoderOobleck",
199199
"AutoencoderTiny",
200200
"AutoModel",
201+
"BriaFiboTransformer2DModel",
201202
"BriaTransformer2DModel",
202203
"CacheMixin",
203204
"ChromaTransformer2DModel",
@@ -430,6 +431,7 @@
430431
"AuraFlowPipeline",
431432
"BlipDiffusionControlNetPipeline",
432433
"BlipDiffusionPipeline",
434+
"BriaFiboPipeline",
433435
"BriaPipeline",
434436
"ChromaImg2ImgPipeline",
435437
"ChromaPipeline",
@@ -901,6 +903,7 @@
901903
AutoencoderOobleck,
902904
AutoencoderTiny,
903905
AutoModel,
906+
BriaFiboTransformer2DModel,
904907
BriaTransformer2DModel,
905908
CacheMixin,
906909
ChromaTransformer2DModel,
@@ -1103,6 +1106,7 @@
11031106
AudioLDM2UNet2DConditionModel,
11041107
AudioLDMPipeline,
11051108
AuraFlowPipeline,
1109+
BriaFiboPipeline,
11061110
BriaPipeline,
11071111
ChromaImg2ImgPipeline,
11081112
ChromaPipeline,

src/diffusers/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
_import_structure["transformers.transformer_2d"] = ["Transformer2DModel"]
8585
_import_structure["transformers.transformer_allegro"] = ["AllegroTransformer3DModel"]
8686
_import_structure["transformers.transformer_bria"] = ["BriaTransformer2DModel"]
87+
_import_structure["transformers.transformer_bria_fibo"] = ["BriaFiboTransformer2DModel"]
8788
_import_structure["transformers.transformer_chroma"] = ["ChromaTransformer2DModel"]
8889
_import_structure["transformers.transformer_cogview3plus"] = ["CogView3PlusTransformer2DModel"]
8990
_import_structure["transformers.transformer_cogview4"] = ["CogView4Transformer2DModel"]
@@ -174,6 +175,7 @@
174175
from .transformers import (
175176
AllegroTransformer3DModel,
176177
AuraFlowTransformer2DModel,
178+
BriaFiboTransformer2DModel,
177179
BriaTransformer2DModel,
178180
ChromaTransformer2DModel,
179181
CogVideoXTransformer3DModel,

src/diffusers/models/transformers/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from .transformer_2d import Transformer2DModel
1919
from .transformer_allegro import AllegroTransformer3DModel
2020
from .transformer_bria import BriaTransformer2DModel
21+
from .transformer_bria_fibo import BriaFiboTransformer2DModel
2122
from .transformer_chroma import ChromaTransformer2DModel
2223
from .transformer_cogview3plus import CogView3PlusTransformer2DModel
2324
from .transformer_cogview4 import CogView4Transformer2DModel

0 commit comments

Comments
 (0)