Instructions to use black-forest-labs/FLUX.1-Kontext-dev with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use black-forest-labs/FLUX.1-Kontext-dev with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Diffusion Single File
How to use black-forest-labs/FLUX.1-Kontext-dev with Diffusion Single File:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Inference
- Notebooks
- Google Colab
- Kaggle
Flux-Kontext Issues With Body Proportion
I am just experimenting with Kontext, and find it does some things very well, but it seems to really have a problem when using a source image that is just face and upper body and then making the end result be a full body image. Here are a couple of examples I made. The first image was made using the default workflow and prompt. The head is way too big for the body.
In the second image, I modified the default workflow to include two images. The issue a little better if I only create square output images, but I really would rather not be limited to that.
Is anyone else seeing this, and have you found a workaround?
I feel like this is a technical problem that is difficult to solve.
I have also encountered this situation.
I think we can try to solve the problem through lora.
However, this does not seem to be easy to solve. After all, the model author should also pay attention to this problem, but it was released without being solved.
I don't know if Pro is like this, and whether there is a downgrade.
Perhaps, you can add prompt words such as: keep the proportion, look good
some one should train decent loras doing this : 1- bigger head make head bigger , 2- smaller head make head smaller
I also noticed this problem, but it is related not only to the head, but also to the legs (they are too short) and the torso.

