Buckets:

download
raw
18.3 kB
import"../chunks/DsnmJJEf.js";import{i as j,h as k,C as U,H as a,a as v,D as r,E as P,s as N}from"../chunks/BtE7mKSK.js";import{p as Z,o as G,s as e,f as B,a as s,b as S,c as l,d,r as c,n as W}from"../chunks/jDjavuwI.js";import{E as X}from"../chunks/SrSJA0zO.js";const C='{"title":"Bria Fibo","local":"bria-fibo","sections":[{"title":"Usage","local":"usage","sections":[],"depth":2},{"title":"BriaFiboPipeline","local":"diffusers.BriaFiboPipeline","sections":[],"depth":2}],"depth":1}';var E=d('<meta name="hf:doc:metadata"/>'),O=d("<p>Example:</p> <!>",1),q=d(`<p></p> <!> <!> <p>Text-to-image models have mastered imagination - but not control. FIBO changes that.</p> <p>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.</p> <p>With only 8 billion parameters, FIBO provides a new level of image quality, prompt adherence and proffesional control.</p> <p>FIBO is trained exclusively on a structured prompt and will not work with freeform text prompts.
you can use the <a href="https://huggingface.co/briaai/FIBO-VLM-prompt-to-JSON" rel="nofollow">FIBO-VLM-prompt-to-JSON</a> model or the <a href="https://huggingface.co/briaai/FIBO-gemini-prompt-to-JSON" rel="nofollow">FIBO-gemini-prompt-to-JSON</a> to convert your freeform text prompt to a structured JSON prompt.</p> <blockquote class="note"><p>Avoid using freeform text prompts directly with FIBO because it does not produce the best results.</p></blockquote> <p>Refer to the Bria Fibo Hugging Face <a href="https://huggingface.co/briaai/FIBO" rel="nofollow">page</a> to learn more.</p> <!> <p><em>As the model is gated, before using it with diffusers you first need to go to the <a href="https://huggingface.co/briaai/FIBO" rel="nofollow">Bria Fibo Hugging Face page</a>, 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.</em></p> <p>Use the command below to log in:</p> <!> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Function invoked when calling the pipeline for generation.</p> <!></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!></div></div> <!> <p></p>`,1);function H(M,T){Z(T,!1),G(()=>{new URLSearchParams(window.location.search).get("fw")}),j();var p=q();k("1soo0i1",o=>{var i=E();N(i,"content",C),s(o,i)});var m=e(B(p),2);U(m,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var u=e(m,2);a(u,{title:"Bria Fibo",local:"bria-fibo",headingTag:"h1"});var g=e(u,14);a(g,{title:"Usage",local:"usage",headingTag:"h2"});var f=e(g,6);v(f,{code:"aGYlMjBhdXRoJTIwbG9naW4=",highlighted:"hf auth login",lang:"bash",wrap:!1});var _=e(f,2);a(_,{title:"BriaFiboPipeline",local:"diffusers.BriaFiboPipeline",headingTag:"h2"});var t=e(_,2),h=l(t);r(h,{name:"class diffusers.BriaFiboPipeline",anchor:"diffusers.BriaFiboPipeline",source:"https://github.com/huggingface/diffusers/blob/vr_14164/src/diffusers/pipelines/bria_fibo/pipeline_bria_fibo.py#L76",parameters:[{name:"transformer",val:": BriaFiboTransformer2DModel"},{name:"scheduler",val:": diffusers.schedulers.scheduling_flow_match_euler_discrete.FlowMatchEulerDiscreteScheduler | diffusers.schedulers.scheduling_utils.KarrasDiffusionSchedulers"},{name:"vae",val:": AutoencoderKLWan"},{name:"text_encoder",val:": SmolLM3ForCausalLM"},{name:"tokenizer",val:": AutoTokenizer"}],parametersDescription:[{anchor:"diffusers.BriaFiboPipeline.transformer",description:`<strong>transformer</strong> (<code>BriaFiboTransformer2DModel</code>) &#x2014;
The transformer model for 2D diffusion modeling.`,name:"transformer"},{anchor:"diffusers.BriaFiboPipeline.scheduler",description:`<strong>scheduler</strong> (<code>FlowMatchEulerDiscreteScheduler</code> or <code>KarrasDiffusionSchedulers</code>) &#x2014;
Scheduler to be used with <code>transformer</code> to denoise the encoded latents.`,name:"scheduler"},{anchor:"diffusers.BriaFiboPipeline.vae",description:`<strong>vae</strong> (<code>AutoencoderKLWan</code>) &#x2014;
Variational Auto-Encoder for encoding and decoding images to and from latent representations.`,name:"vae"},{anchor:"diffusers.BriaFiboPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>SmolLM3ForCausalLM</code>) &#x2014;
Text encoder for processing input prompts.`,name:"text_encoder"},{anchor:"diffusers.BriaFiboPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>AutoTokenizer</code>) &#x2014;
Tokenizer used for processing the input text prompts for the text_encoder.`,name:"tokenizer"}]});var n=e(h,2),b=l(n);r(b,{name:"__call__",anchor:"diffusers.BriaFiboPipeline.__call__",source:"https://github.com/huggingface/diffusers/blob/vr_14164/src/diffusers/pipelines/bria_fibo/pipeline_bria_fibo.py#L445",parameters:[{name:"prompt",val:": str | list[str] = None"},{name:"height",val:": int | None = None"},{name:"width",val:": int | None = None"},{name:"num_inference_steps",val:": int = 30"},{name:"timesteps",val:": list = None"},{name:"guidance_scale",val:": float = 5"},{name:"negative_prompt",val:": str | list[str] | None = None"},{name:"num_images_per_prompt",val:": int | None = 1"},{name:"generator",val:": typing.Union[torch.Generator, list[torch.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": str | None = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"joint_attention_kwargs",val:": dict[str, typing.Any] | None = None"},{name:"callback_on_step_end",val:": typing.Optional[typing.Callable[[int, int], NoneType]] = None"},{name:"callback_on_step_end_tensor_inputs",val:": list = ['latents']"},{name:"max_sequence_length",val:": int = 3000"},{name:"do_patching",val:" = False"}],parametersDescription:[{anchor:"diffusers.BriaFiboPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>list[str]</code>) &#x2014;
The prompt or prompts to guide the image generation.`,name:"prompt"},{anchor:"diffusers.BriaFiboPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size * self.vae_scale_factor) &#x2014;
The height in pixels of the generated image. This is set to 1024 by default for the best results.`,name:"height"},{anchor:"diffusers.BriaFiboPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size * self.vae_scale_factor) &#x2014;
The width in pixels of the generated image. This is set to 1024 by default for the best results.`,name:"width"},{anchor:"diffusers.BriaFiboPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.BriaFiboPipeline.__call__.timesteps",description:`<strong>timesteps</strong> (<code>list[int]</code>, <em>optional</em>) &#x2014;
Custom timesteps to use for the denoising process with schedulers which support a <code>timesteps</code> argument
in their <code>set_timesteps</code> method. If not defined, the default behavior when <code>num_inference_steps</code> is
passed will be used. Must be in descending order.`,name:"timesteps"},{anchor:"diffusers.BriaFiboPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 5.0) &#x2014;
Guidance scale as defined in <a href="https://huggingface.co/papers/2207.12598" rel="nofollow">Classifier-Free Diffusion
Guidance</a>. <code>guidance_scale</code> is defined as <code>w</code> of equation 2.
of <a href="https://huggingface.co/papers/2205.11487" rel="nofollow">Imagen Paper</a>. Guidance scale is enabled by setting
<code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to
the text <code>prompt</code>, usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.BriaFiboPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>list[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
if <code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.BriaFiboPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.BriaFiboPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>list[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.BriaFiboPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.BriaFiboPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.BriaFiboPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>~pipelines.stable_diffusion_xl.StableDiffusionXLPipelineOutput</code> instead
of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.BriaFiboPipeline.__call__.joint_attention_kwargs",description:`<strong>joint_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"joint_attention_kwargs"},{anchor:"diffusers.BriaFiboPipeline.__call__.callback_on_step_end",description:`<strong>callback_on_step_end</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that calls at the end of each denoising steps during the inference. The function is called
with the following arguments: <code>callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)</code>. <code>callback_kwargs</code> will include a list of all tensors as specified by
<code>callback_on_step_end_tensor_inputs</code>.`,name:"callback_on_step_end"},{anchor:"diffusers.BriaFiboPipeline.__call__.callback_on_step_end_tensor_inputs",description:`<strong>callback_on_step_end_tensor_inputs</strong> (<code>List</code>, <em>optional</em>) &#x2014;
The list of tensor inputs for the <code>callback_on_step_end</code> function. The tensors specified in the list
will be passed as <code>callback_kwargs</code> argument. You will only be able to include variables listed in the
<code>._callback_tensor_inputs</code> attribute of your pipeline class.`,name:"callback_on_step_end_tensor_inputs"},{anchor:"diffusers.BriaFiboPipeline.__call__.max_sequence_length",description:"<strong>max_sequence_length</strong> (<code>int</code> defaults to 3000) &#x2014; Maximum sequence length to use with the <code>prompt</code>.",name:"max_sequence_length"},{anchor:"diffusers.BriaFiboPipeline.__call__.do_patching",description:"<strong>do_patching</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014; Whether to use patching.",name:"do_patching"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p><code>~pipelines.flux.BriaFiboPipelineOutput</code> if
<code>return_dict</code> is True, otherwise a <code>tuple</code>. When returning a tuple, the first element is a list with the
generated images.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>
<p><code>~pipelines.flux.BriaFiboPipelineOutput</code> or <code>tuple</code></p>
`});var F=e(b,4);X(F,{anchor:"diffusers.BriaFiboPipeline.__call__.example",children:(o,i)=>{var y=O(),I=e(B(y),2);v(I,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQnJpYUZpYm9QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMubW9kdWxhcl9waXBlbGluZXMlMjBpbXBvcnQlMjBNb2R1bGF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wZShwcm9tcHQlM0Rqc29uX3Byb21wdF9nZW5lcmF0ZSUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0Q1MCUyQyUyMGd1aWRhbmNlX3NjYWxlJTNENSklMEElMjAlMjAlMjAlMjByZXN1bHRzX2dlbmVyYXRlLmltYWdlcyU1QjAlNUQuc2F2ZSglMjJpbWFnZV9nZW5lcmF0ZS5wbmclMjIp",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> BriaFiboPipeline
<span class="hljs-keyword">from</span> diffusers.modular_pipelines <span class="hljs-keyword">import</span> ModularPipeline
torch.set_grad_enabled(<span class="hljs-literal">False</span>)
vlm_pipe = ModularPipeline.from_pretrained(<span class="hljs-string">&quot;briaai/FIBO-VLM-prompt-to-JSON&quot;</span>, trust_remote_code=<span class="hljs-literal">True</span>)
pipe = BriaFiboPipeline.from_pretrained(
<span class="hljs-string">&quot;briaai/FIBO&quot;</span>,
trust_remote_code=<span class="hljs-literal">True</span>,
torch_dtype=torch.bfloat16,
)
pipe.enable_model_cpu_offload()
<span class="hljs-keyword">with</span> torch.inference_mode():
<span class="hljs-comment"># 1. Create a prompt to generate an initial image</span>
output = vlm_pipe(prompt=<span class="hljs-string">&quot;a beautiful dog&quot;</span>)
json_prompt_generate = output.values[<span class="hljs-string">&quot;json_prompt&quot;</span>]
<span class="hljs-comment"># Generate the image from the structured json prompt</span>
results_generate = pipe(prompt=json_prompt_generate, num_inference_steps=<span class="hljs-number">50</span>, guidance_scale=<span class="hljs-number">5</span>)
results_generate.images[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;image_generate.png&quot;</span>)`,lang:"python",wrap:!1}),s(o,y)},$$slots:{default:!0}}),c(n);var w=e(n,2),J=l(w);r(J,{name:"encode_prompt",anchor:"diffusers.BriaFiboPipeline.encode_prompt",source:"https://github.com/huggingface/diffusers/blob/vr_14164/src/diffusers/pipelines/bria_fibo/pipeline_bria_fibo.py#L201",parameters:[{name:"prompt",val:": str | list[str]"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"num_images_per_prompt",val:": int = 1"},{name:"guidance_scale",val:": float = 5"},{name:"negative_prompt",val:": str | list[str] | None = None"},{name:"max_sequence_length",val:": int = 3000"},{name:"lora_scale",val:": float | None = None"}],parametersDescription:[{anchor:"diffusers.BriaFiboPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>list[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"},{anchor:"diffusers.BriaFiboPipeline.encode_prompt.device",description:`<strong>device</strong> &#x2014; (<code>torch.device</code>):
torch device`,name:"device"},{anchor:"diffusers.BriaFiboPipeline.encode_prompt.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>) &#x2014;
number of images that should be generated per prompt`,name:"num_images_per_prompt"},{anchor:"diffusers.BriaFiboPipeline.encode_prompt.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>) &#x2014;
Guidance scale for classifier free guidance.`,name:"guidance_scale"},{anchor:"diffusers.BriaFiboPipeline.encode_prompt.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>list[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
if <code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"}]}),c(w),c(t);var x=e(t,2);P(x,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/bria_fibo.md"}),W(2),s(M,p),S()}export{H as component};

Xet Storage Details

Size:
18.3 kB
·
Xet hash:
8ea8ec9787f407ec4aa70410a9f43d67dee654811755a41f81d77a7a5f608bad

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.