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
RuntimeError: mat1 and mat2 shapes cannot be multiplied (512x4096 and 12288x4096)
I'm getting crazy and always get this error!
I tried both with gguf or safetensor, always getting that kind of error
Ubuntu 24.04 2 x R9700 AI pro
comfyui 0.18
running on a docker:
docker run -it --rm --name comfyui-run
--device=/dev/kfd --device=/dev/dri
--group-add video
--dns 8.8.8.8
-v /mnt/dati/grafica/Comfyui:/app
-p 8188:8188
-e HIP_VISIBLE_DEVICES=1
-e GIT_PYTHON_REFRESH=quiet
comfyui-flux-finale:v2
/opt/venv/bin/python /app/main.py --highvram --listen 0.0.0.0 --enable-manager
Using duel clip was for flux 1. With flux2 I found it to be a pain in the butt. basic load CLIP with type set to flux2 and a positive prompt stopped this error for me. I have different errors now, but that's not one of them.
