Instructions to use black-forest-labs/FLUX.2-dev with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use black-forest-labs/FLUX.2-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.2-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.2-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
[Question] Frequent anatomical hallucinations and the effectiveness of Negative Prompts
Thank you for the incredible work on the Flux2 models. The image quality is impressive.
During my testing, I have observed that the model frequently produces anatomical errors (e.g., incorrect number of fingers, distorted limbs), arguably more often than expected for a model of this caliber.
My questions are:
Is the lack of effective support for Negative Prompts a contributing factor to these anatomical issues?
Since Flux2 seems to ignore negative prompts, is there a recommended approach or specific parameter setting (e.g., guidance scale) to strictly enforce anatomical correctness?
I would appreciate any insights or advice on how to mitigate these anatomical hallucinations.
Thank you!
The anatomical errors are caused by the post-training censorship mentioned here (https://huggingface.co/black-forest-labs/FLUX.2-dev#risks), with the same consequences as for StableDiffusion 3. A seemingly capable model that doesn't know how many arms or legs a human is supposed to have, let alone fingers.
I would also note that other models with guidance distillation like Flux 1 Dev did not suffer these issues.
Edit: If you use ComfyUI like me, then it seems a lot of the artifacts are caused by wrong sampler scheduling. A custom node called 'FlowMatchEulerDiscreteScheduler` fixes the issue.