Instructions to use black-forest-labs/FLUX.2-klein-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use black-forest-labs/FLUX.2-klein-9B 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-klein-9B", 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-klein-9B 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
The flux workflow became very slow
A few weeks ago, I used flux.2 (flux-2-klein-9b-fp8), and everything seemed good, with the speed within the normal range. I didn't use it for the past few weeks, and when I used it yesterday, I found that the speed had become extremely slow, almost unbearable. Generating a 720*1280 image takes almost an hour, whereas it used to be done in less than a minute. Of course, I keep tinkering with my ComfyUI these weeks , I have tried many other models and installed quite a few plugins.
Here is my environment information:
Windows 11 Pro
GeForce RTX 5070 12GB
Python 3.10
torch-2.9.1+cu130
ComfyUI 0.9.2
ComfyUI_frontend v1.36.14
.\venv310\Scripts\python.exe -s ComfyUI\main.py --windows-standalone-build
Did I do something wrong, or is there any other information needed to specifically identify the problem, or maybe I ask in the wrong community?
This is the case for me as well. Something is really slowing things down now.