Buckets:

download
raw
23.3 kB
import"../chunks/DsnmJJEf.js";import{i as x,h as k,C as G,H as d,a as B,D as i,E as W,s as P}from"../chunks/BLbO27j4.js";import{p as N,o as C,s as e,f as J,a as c,b as L,c as o,d as p,r as n,n as v}from"../chunks/jDjavuwI.js";import{E as X}from"../chunks/DFZbkwCk.js";const z='{"title":"Bria Fibo Edit","local":"bria-fibo-edit","sections":[{"title":"Usage","local":"usage","sections":[],"depth":2},{"title":"BriaFiboEditPipeline","local":"diffusers.BriaFiboEditPipeline","sections":[],"depth":2}],"depth":1}';var S=p('<meta name="hf:doc:metadata"/>'),Q=p("<p>Example:</p> <!>",1),V=p(`<p></p> <!> <!> <p>Fibo Edit is an 8B parameter image-to-image model that introduces a new paradigm of structured control, operating on JSON inputs paired with source images to enable deterministic and repeatable editing workflows.
Featuring native masking for granular precision, it moves beyond simple prompt-based diffusion to offer explicit, interpretable control optimized for production environments.
Its lightweight architecture is designed for deep customization, empowering researchers to build specialized “Edit” models for domain-specific tasks while delivering top-tier aesthetic quality</p> <p>Refer to the Bria Fibo Edit Hugging Face <a href="https://huggingface.co/briaai/Fibo-Edit-1.5-base" rel="nofollow">page</a> to learn more. A distilled checkpoint is available at <a href="https://huggingface.co/briaai/Fibo-Edit-1.5-turbo" rel="nofollow">Fibo-Edit-1.5-turbo</a>.</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-Edit-1.5-base" rel="nofollow">Bria Fibo Edit 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 class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>VAE-encode one PIL reference at its own size and pack it as an edit-context token stream.</p></div></div> <!> <p></p>`,1);function A(T,U){N(U,!1),C(()=>{new URLSearchParams(window.location.search).get("fw")}),x();var m=V();k("1pu9kow",t=>{var l=S();P(l,"content",z),c(t,l)});var u=e(J(m),2);G(u,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var g=e(u,2);d(g,{title:"Bria Fibo Edit",local:"bria-fibo-edit",headingTag:"h1"});var f=e(g,6);d(f,{title:"Usage",local:"usage",headingTag:"h2"});var h=e(f,6);B(h,{code:"aGYlMjBhdXRoJTIwbG9naW4=",highlighted:"hf auth login",lang:"bash",wrap:!1});var _=e(h,2);d(_,{title:"BriaFiboEditPipeline",local:"diffusers.BriaFiboEditPipeline",headingTag:"h2"});var a=e(_,2),b=o(a);i(b,{name:"class diffusers.BriaFiboEditPipeline",anchor:"diffusers.BriaFiboEditPipeline",source:"https://github.com/huggingface/diffusers/blob/vr_14739/src/diffusers/pipelines/bria_fibo/pipeline_bria_fibo_edit.py#L240",parameters:[{name:"transformer",val:": BriaFiboTransformer2DModel"},{name:"scheduler",val:": typing.Union[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.BriaFiboEditPipeline.transformer",description:`<strong>transformer</strong> (<code>BriaFiboTransformer2DModel</code>) &#x2014;
The transformer model for 2D diffusion modeling.`,name:"transformer"},{anchor:"diffusers.BriaFiboEditPipeline.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.BriaFiboEditPipeline.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.BriaFiboEditPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>SmolLM3ForCausalLM</code>) &#x2014;
Text encoder for processing input prompts.`,name:"text_encoder"},{anchor:"diffusers.BriaFiboEditPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>AutoTokenizer</code>) &#x2014;
Tokenizer used for processing the input text prompts for the text_encoder.`,name:"tokenizer"}]});var s=e(b,2),y=o(s);i(y,{name:"__call__",anchor:"diffusers.BriaFiboEditPipeline.__call__",source:"https://github.com/huggingface/diffusers/blob/vr_14739/src/diffusers/pipelines/bria_fibo/pipeline_bria_fibo_edit.py#L599",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"image",val:": typing.Union[PIL.Image.Image, typing.List[PIL.Image.Image], NoneType] = None"},{name:"mask",val:": typing.Union[torch.FloatTensor, PIL.Image.Image, typing.List[PIL.Image.Image], typing.List[torch.FloatTensor], numpy.ndarray, typing.List[numpy.ndarray], NoneType] = None"},{name:"height",val:": int | None = None"},{name:"width",val:": int | None = None"},{name:"num_inference_steps",val:": int = 30"},{name:"timesteps",val:": typing.List[int] = None"},{name:"seed",val:": int | None = None"},{name:"guidance_scale",val:": float = 5"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 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 = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"joint_attention_kwargs",val:": typing.Optional[typing.Dict[str, typing.Any]] = None"},{name:"callback_on_step_end",val:": typing.Optional[typing.Callable[[int, int, typing.Dict], NoneType]] = None"},{name:"callback_on_step_end_tensor_inputs",val:": typing.List[str] = ['latents']"},{name:"max_sequence_length",val:": int = 3000"},{name:"do_patching",val:" = False"},{name:"_auto_resize",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.BriaFiboEditPipeline.__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.BriaFiboEditPipeline.__call__.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>List[PIL.Image.Image]</code>, <em>optional</em>) &#x2014;
One or more reference images to guide the image generation. A list is interpreted as multiple
references (not a batch): each reference is VAE-encoded at its own aspect ratio and placed on its own
RoPE time plane 1, 2, &#x2026; . If not defined, the pipeline generates an image from scratch.`,name:"image"},{anchor:"diffusers.BriaFiboEditPipeline.__call__.mask",description:`<strong>mask</strong> (<code>PipelineMaskInput</code>, <em>optional</em>) &#x2014;
Optional mask defining the region of <code>image</code> to be edited. Pixels covered by the mask are regenerated
while the rest of the image is preserved.`,name:"mask"},{anchor:"diffusers.BriaFiboEditPipeline.__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.BriaFiboEditPipeline.__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.BriaFiboEditPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 30) &#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.BriaFiboEditPipeline.__call__.seed",description:`<strong>seed</strong> (<code>int</code>, <em>optional</em>) &#x2014;
A seed used to make generation deterministic.`,name:"seed"},{anchor:"diffusers.BriaFiboEditPipeline.__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.BriaFiboEditPipeline.__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.BriaFiboEditPipeline.__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.BriaFiboEditPipeline.__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.BriaFiboEditPipeline.__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.BriaFiboEditPipeline.__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.BriaFiboEditPipeline.__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.BriaFiboEditPipeline.__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.BriaFiboEditPipeline.__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.BriaFiboEditPipeline.__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.BriaFiboEditPipeline.__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.BriaFiboEditPipeline.__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.BriaFiboEditPipeline.__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"},{anchor:"diffusers.BriaFiboEditPipeline.__call__._auto_resize",description:`<strong>_auto_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to snap the default output resolution (taken from the first reference image) to the preferred
resolutions.`,name:"_auto_resize"}],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 E=e(y,4);X(E,{anchor:"diffusers.BriaFiboEditPipeline.__call__.example",children:(t,l)=>{var w=Q(),Z=e(J(w),2);B(Z,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQnJpYUZpYm9FZGl0UGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLm1vZHVsYXJfcGlwZWxpbmVzJTIwaW1wb3J0JTIwTW9kdWxhclBpcGVsaW5lQmxvY2tzJTBBJTBBJTIzJTIwVGhpcyUyMHByb21wdC10by1KU09OJTIwYmxvY2slMjBjYWxscyUyMEdlbWluaSUyMGFuZ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IyYnJpYWFpJTJGRmliby1FZGl0LTEuNS10dXJibyUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYpJTBBcGlwZS50byglMjJjdWRhJTIyKSUwQXJlc3VsdCUyMCUzRCUyMHBpcGUocHJvbXB0JTNEanNvbl9wcm9tcHQlMkMlMjBpbWFnZSUzRCU1Qm93bCUyQyUyMGZvcmVzdCU1RCUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0Q0JTJDJTIwZ3VpZGFuY2Vfc2NhbGUlM0QxKQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> BriaFiboEditPipeline
<span class="hljs-keyword">from</span> diffusers.modular_pipelines <span class="hljs-keyword">import</span> ModularPipelineBlocks
<span class="hljs-comment"># This prompt-to-JSON block calls Gemini and needs GEMINI_API_KEY in the environment.</span>
vlm_pipe = ModularPipelineBlocks.from_pretrained(<span class="hljs-string">&quot;briaai/FIBO-edit-gemini-prompt-to-JSON&quot;</span>, trust_remote_code=<span class="hljs-literal">True</span>)
vlm_pipe = vlm_pipe.init_pipeline()
pipe = BriaFiboEditPipeline.from_pretrained(
<span class="hljs-string">&quot;briaai/Fibo-Edit-1.5-base&quot;</span>,
torch_dtype=torch.bfloat16,
)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
image = Image.<span class="hljs-built_in">open</span>(<span class="hljs-string">&quot;owl.png&quot;</span>)
json_prompt = vlm_pipe(image=image, prompt=<span class="hljs-string">&quot;Make the owl into a cat&quot;</span>).values[<span class="hljs-string">&quot;json_prompt&quot;</span>]
result = pipe(prompt=json_prompt, image=image, num_inference_steps=<span class="hljs-number">30</span>, guidance_scale=<span class="hljs-number">5</span>)
<span class="hljs-comment"># Multiple reference images: pass a list. Each reference conditions the edit at its</span>
<span class="hljs-comment"># own aspect ratio; the output resolution follows the first reference.</span>
owl, forest = Image.<span class="hljs-built_in">open</span>(<span class="hljs-string">&quot;owl.png&quot;</span>), Image.<span class="hljs-built_in">open</span>(<span class="hljs-string">&quot;forest.png&quot;</span>)
json_prompt = vlm_pipe(
image=[owl, forest], prompt=<span class="hljs-string">&quot;Place the owl from the first image in the forest from the second image&quot;</span>
).values[<span class="hljs-string">&quot;json_prompt&quot;</span>]
result = pipe(
prompt=json_prompt,
image=[owl, forest],
num_inference_steps=<span class="hljs-number">30</span>,
guidance_scale=<span class="hljs-number">5</span>,
)
<span class="hljs-comment"># The distilled Turbo checkpoint edits in 4 steps without classifier-free guidance.</span>
pipe = BriaFiboEditPipeline.from_pretrained(<span class="hljs-string">&quot;briaai/Fibo-Edit-1.5-turbo&quot;</span>, torch_dtype=torch.bfloat16)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
result = pipe(prompt=json_prompt, image=[owl, forest], num_inference_steps=<span class="hljs-number">4</span>, guidance_scale=<span class="hljs-number">1</span>)`,lang:"python",wrap:!1}),c(t,w)},$$slots:{default:!0}}),n(s);var r=e(s,2),I=o(r);i(I,{name:"encode_prompt",anchor:"diffusers.BriaFiboEditPipeline.encode_prompt",source:"https://github.com/huggingface/diffusers/blob/vr_14739/src/diffusers/pipelines/bria_fibo/pipeline_bria_fibo_edit.py#L365",parameters:[{name:"prompt",val:": typing.Union[str, typing.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:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"max_sequence_length",val:": int = 3000"},{name:"lora_scale",val:": bool | None = None"}],parametersDescription:[{anchor:"diffusers.BriaFiboEditPipeline.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.BriaFiboEditPipeline.encode_prompt.device",description:`<strong>device</strong> &#x2014; (<code>torch.device</code>):
torch device`,name:"device"},{anchor:"diffusers.BriaFiboEditPipeline.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.BriaFiboEditPipeline.encode_prompt.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>) &#x2014;
Guidance scale for classifier free guidance.`,name:"guidance_scale"},{anchor:"diffusers.BriaFiboEditPipeline.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"}]}),n(r);var M=e(r,2),j=o(M);i(j,{name:"prepare_reference_latents",anchor:"diffusers.BriaFiboEditPipeline.prepare_reference_latents",source:"https://github.com/huggingface/diffusers/blob/vr_14739/src/diffusers/pipelines/bria_fibo/pipeline_bria_fibo_edit.py#L992",parameters:[{name:"image",val:": Image"},{name:"num_channels_latents",val:": int"},{name:"dtype",val:": dtype"},{name:"device",val:": device"},{name:"do_patching",val:": bool = False"},{name:"reference_index",val:": int = 1"}]}),v(2),n(M),n(a);var F=e(a,2);W(F,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/bria_fibo_edit.md"}),v(2),c(T,m),L()}export{A as component};

Xet Storage Details

Size:
23.3 kB
·
Xet hash:
45ac22f1677d8ad60109d876103e877bd1b5ed900eb3c2b31cde24b64698f5a4

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