# Diffusers welcomes FLUX-2

[Hugging Face](https://yomu.fyi/company/hugging-face) · YiYi Xu, Daniel Gu, Sayak Paul, Alvaro Somoza, Dhruv Nair, Aritra Roy Gosthipaty, Linoy Tsaban, Apolinário from multimodal AI art · Nov 25, 2025

**Type:** Tutorial

## Summary

Diffusers introduces support for FLUX-2 models through the Flux2Pipeline and Flux2Transformer2DModel classes. Running the 4-bit quantized checkpoint diffusers/FLUX.2-dev-bnb-4bit requires loading Mistral3ForConditionalGeneration as the text encoder and the transformer in bfloat16 precision with CPU offloading enabled. During image generation with a prompt and 50 inference steps, the pipeline encodes text embeddings through the Mistral 3 model before executing diffusion operations. However, executing the pipeline on a GPU with 14.56 GiB capacity triggers a CUDA OutOfMemoryError during 4-bit dequantization inside bitsandbytes matrix multiplication operations. Additionally, the execution logs warn that Flax classes are deprecated in Diffusers and will be removed in version 1.0.0.

## Context

Running 4-bit quantized FLUX-2 text-to-image generation using Diffusers and Transformers on GPU hardware with CPU model offloading.

## Approach / What changed

Loading Flux2Transformer2DModel and Mistral3ForConditionalGeneration from diffusers/FLUX.2-dev-bnb-4bit with bfloat16 precision, configuring Flux2Pipeline with CPU offload, and generating an image via prompt encoding and diffusion steps.

## Takeaways

- FLUX.2 pipeline integration in Diffusers pairs Flux2Transformer2DModel with Mistral3ForConditionalGeneration as the text encoder.
- Inference on a 14.56 GiB GPU with 4-bit bitsandbytes quantization and CPU offloading encountered a CUDA OutOfMemoryError during linear dequantization.
- Flax classes are deprecated across Diffusers and are scheduled to be removed in version 1.0.0.

**Tags:** [Machine Learning](https://yomu.fyi/topic/machine-learning), [Open Source](https://yomu.fyi/topic/open-source), [Python](https://yomu.fyi/topic/python)

[Read original post](https://huggingface.co/blog/flux-2)
