fix(bria_fibo): fix guidance_embeds, prompt_embeds, tensor-image and multi-image crashes by akshan-main · Pull Request #13981 · huggingface/diffusers · GitHub
Skip to content

fix(bria_fibo): fix guidance_embeds, prompt_embeds, tensor-image and multi-image crashes - #13981

Merged
yiyixuxu merged 2 commits into
huggingface:mainfrom
akshan-main:fix-bria-fibo-crashes
Jun 25, 2026
Merged

yiyixuxu merged 2 commits into
huggingface:mainfrom
akshan-main:fix-bria-fibo-crashes

Conversation

@akshan-main

@akshan-main akshan-main commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Part of #13618 (bria_fibo review). Fixes four runtime crashes:

  • guidance_embeds=True couldn't construct the transformer: the guidance embedder was built without the required time_theta, and the forward tested a tensor with if guidance:.
  • prompt_embeds / negative_prompt_embeds were public inputs that can't work standalone: the transformer also needs the per-layer embeddings, which only come from encoding prompt. Removed both args from both pipelines.
  • BriaFiboEditPipeline crashed on tensor image inputs, which referenced an undefined self.latent_channels.
  • num_images_per_prompt > 1 returned a malformed output shape (extra batch axis for numpy, nested lists for PIL). The decode now runs once over the full latent batch and post-processes once, which gives the right shape.

Verified each against the repros in the issue.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline?
  • Did you read our philosophy doc (important for complex PRs)?
  • Was this discussed/approved via a GitHub issue or the forum? Discussed on Slack with @yiyixuxu
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

Who can review?

@yiyixuxu @sayakpaul

@github-actions

Copy link
Copy Markdown
Contributor

@yiyixuxu yiyixuxu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, i left some comments

@@ -260,6 +260,11 @@ def encode_prompt(
)
prompt_embeds = prompt_embeds.to(dtype=self.transformer.dtype)
prompt_layers = [tensor.to(dtype=self.transformer.dtype) for tensor in prompt_layers]
else:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's just remove this argument?

@akshan-main akshan-main Jun 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! removed both prompt_embeds and negative_prompt_embeds (the latter was recomputed from negative_prompt and ignored anyway).

@@ -773,10 +778,11 @@ def __call__(
for scaled_latent in latents_scaled:
curr_image = self.vae.decode(scaled_latent.unsqueeze(0), return_dict=False)[0]
curr_image = self.image_processor.postprocess(curr_image.squeeze(dim=2), output_type=output_type)
image.append(curr_image)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason that they have to decode and post-process latent one each time?

@akshan-main akshan-main Jun 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, they're already a single batched tensor, so switched to one decode + postprocess

@github-actions github-actions Bot added size/L PR with diff > 200 LOC and removed size/S PR with diff < 50 LOC labels Jun 24, 2026
@akshan-main
akshan-main requested a review from yiyixuxu June 24, 2026 18:40

@yiyixuxu yiyixuxu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

@yiyixuxu
yiyixuxu merged commit d8d3f90 into huggingface:main Jun 25, 2026
15 checks passed
DN6 pushed a commit that referenced this pull request Jul 1, 2026
…multi-image crashes (#13981)

* fix(bria_fibo): fix guidance_embeds, prompt_embeds, tensor-image and multi-image crashes

* remove unusable precomputed-embeds args and batch-decode output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

models pipelines size/L PR with diff > 200 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants