Skip to content

[Flux Kontext] Support Fal Kontext LoRA #11823

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

Merged
merged 10 commits into from
Jul 2, 2025

Conversation

linoytsaban
Copy link
Collaborator

example:

import torch
from diffusers import FluxKontextPipeline
from diffusers.utils import load_image

pipe = FluxKontextPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", torch_dtype=torch.bfloat16)
pipe.load_lora_weights("fal/Plushie-Kontext-Dev-LoRA", weight_name="plushie-kontext-dev-lora.safetensors")

pipe.to("cuda")

input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png")

image = pipe(
  image=input_image,
  prompt="Convert to plushie style",
  guidance_scale=2.5
).images[0]

image
image

@linoytsaban linoytsaban requested review from a-r-r-o-w and sayakpaul and removed request for a-r-r-o-w June 27, 2025 15:15
@linoytsaban
Copy link
Collaborator Author

@bot /style

Copy link
Contributor

github-actions bot commented Jun 27, 2025

Style bot fixed some files and pushed the changes.

@linoytsaban linoytsaban requested a review from a-r-r-o-w June 27, 2025 15:18
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

Thanks for doing it! Since it shares a significantly amount of overlap with the existing conversion methods, could we try to leverage them instead?

@linoytsaban
Copy link
Collaborator Author

linoytsaban commented Jun 27, 2025

IIRC it overlaps the most with bfl_control lora but diverges in the norms, context_embedder, X_embedder, guidance and time_text_embed (and other minor things like the block prefix). Could try to refactor the bfl control conversion to account for both use cases

@sayakpaul
Copy link
Member

Cool, let's merge this PR and then do a refactor in the future one?

@linoytsaban
Copy link
Collaborator Author

linoytsaban commented Jun 30, 2025

Cool, let's merge this PR and then do a refactor in the future one?

SG to me :)

@linoytsaban
Copy link
Collaborator Author

@sayakpaul these failing tests seem unrelated, no?

@sayakpaul
Copy link
Member

Yeah failures don't seem related.

@linoytsaban linoytsaban merged commit f864a9a into huggingface:main Jul 2, 2025
27 of 28 checks passed
tolgacangoz pushed a commit to tolgacangoz/diffusers that referenced this pull request Jul 5, 2025
* initial commit

* initial commit

* initial commit

* fix import

* fix prefix

* remove print

* Apply style fixes

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants