-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Bria 3 2 pipeline #12010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
galbria
wants to merge
29
commits into
huggingface:main
Choose a base branch
from
galbria:bria_3_2_pipeline
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Bria 3 2 pipeline #12010
Changes from 23 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
00dfe98
Add Bria model and pipeline to diffusers
galbria 7808ee0
with working tests
galbria c58267e
style and quality pass
galbria 4208a09
Merge branch 'main' of https://github.com/huggingface/diffusers into …
galbria 7c1cf7e
adding docs
galbria 92671ab
add to overview
galbria 649767f
Merge branch 'main' into bria_3_2_pipeline
galbria be29631
fixes from "make fix-copies"
galbria eb1a3f4
Merge branch 'bria_3_2_pipeline' of https://github.com/galbria/diffus…
galbria 88c8e42
Refactor transformer_bria.py and pipeline_bria.py: Introduce new Embe…
galbria 6cefe44
remove redundent and duplicates tests and fix bf16
galbria 770e162
Merge branch 'main' into bria_3_2_pipeline
galbria f27d122
style fixes
galbria f48d072
Merge branch 'bria_3_2_pipeline' of https://github.com/galbria/diffus…
galbria e7b6db5
Merge branch 'main' into bria_3_2_pipeline
galbria 7091624
Merge branch 'main' into bria_3_2_pipeline
galbria 7b4b8d1
Merge branch 'main' into bria_3_2_pipeline
galbria a423221
small doc update
galbria 63c9078
Merge branch 'bria_3_2_pipeline' of https://github.com/galbria/diffus…
galbria 6f656e7
Merge branch 'main' into bria_3_2_pipeline
galbria 1af2dc0
Merge branch 'main' into bria_3_2_pipeline
linoytsaban 5bfd733
Enhance Bria 3.2 documentation and implementation
galbria 081ac14
Merge branch 'bria_3_2_pipeline' of https://github.com/galbria/diffus…
galbria 83e3f3a
Merge branch 'main' into bria_3_2_pipeline
galbria d2fba0a
Refactor Bria model components and update documentation
galbria a121f58
Merge branch 'bria_3_2_pipeline' of https://github.com/galbria/diffus…
galbria 3890979
Merge branch 'main' into bria_3_2_pipeline
galbria d7dd8b3
Update Bria model reference in documentation to reflect new file nami…
galbria 4dd04ba
Merge branch 'bria_3_2_pipeline' of https://github.com/galbria/diffus…
galbria File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!--Copyright 2025 The HuggingFace Team. All rights reserved. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations under the License. | ||
--> | ||
|
||
# BriaTransformer2DModel | ||
|
||
A modified flux Transformer model from [Bria](https://huggingface.co/briaai/BRIA-3.2) | ||
|
||
## BriaTransformer2DModel | ||
|
||
[[autodoc]] BriaTransformer2DModel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<!--Copyright 2025 The HuggingFace Team. All rights reserved. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations under the License. | ||
--> | ||
|
||
# Bria 3.2 | ||
|
||
Bria 3.2 is the next-generation commercial-ready text-to-image model. With just 4 billion parameters, it provides exceptional aesthetics and text rendering, evaluated to provide on par results to leading open-source models, and outperforming other licensed models. | ||
In addition to being built entirely on licensed data, 3.2 provides several advantages for enterprise and commercial use: | ||
|
||
- Efficient Compute - the model is X3 smaller than the equivalent models in the market (4B parameters vs 12B parameters other open source models) | ||
- Architecture Consistency: Same architecture as 3.1—ideal for users looking to upgrade without disruption. | ||
- Fine-tuning Speedup: 2x faster fine-tuning on L40S and A100. | ||
|
||
Original model checkpoints for Bria 3.2 can be found [here](https://huggingface.co/briaai/BRIA-3.2). | ||
Github repo for Bria 3.2 can be found [here](https://github.com/Bria-AI/BRIA-3.2). | ||
|
||
If you want to learn more about the Bria platform, and get free traril access, please visit [bria.ai](https://bria.ai). | ||
|
||
|
||
## Usage | ||
|
||
_As the model is gated, before using it with diffusers you first need to go to the [Bria 3.2 Hugging Face page](https://huggingface.co/briaai/BRIA-3.2), 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._ | ||
|
||
Use the command below to log in: | ||
|
||
```bash | ||
hf auth login | ||
``` | ||
|
||
## Inference | ||
|
||
|
||
```python | ||
import torch | ||
from diffusers import BriaPipeline | ||
|
||
pipe = BriaPipeline.from_pretrained("briaai/BRIA-3.2",revision="bria_3_2_diffusers", torch_dtype=torch.bfloat16) | ||
galbria marked this conversation as resolved.
Show resolved
Hide resolved
|
||
pipe.enable_model_cpu_offload() | ||
|
||
prompt = "A high-fashion close-up portrait of a blonde woman in clear sunglasses. The image uses a bold teal and red color split for dramatic lighting. The background is a simple teal-green. The photo is sharp and well-composed, and is designed for viewing with anaglyph 3D glasses for optimal effect. It looks professionally done." | ||
|
||
image = pipe(prompt).images[0] | ||
image.save("bria.png") | ||
``` | ||
|
||
|
||
## BriaPipeline | ||
|
||
[[autodoc]] BriaPipeline | ||
- all | ||
- __call__ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think we can remove this subsection entirely. The inference example will directly be rendered from the pipeline when autodoc creates the diffusers docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I don't think this is a good idea for gated repos, first time users or people not familiar with them will get an error while expecting to work which is not a good user experience.
Not strongly opinioned about this so if you think is not necessary I'm fine with it.