Is your feature request related to a problem? Please describe.
Currently, the diffusers library supports the base text-to-image Flux2KleinPipeline, but it lacks native support for Image-to-Image generation (Img2Img) for the FLUX.2 Klein architecture. Because Klein uses a highly optimized, compact structure (single text encoder, specific VAE patchification, and built-in batch normalization), users cannot simply drop Klein weights into the standard FluxImg2ImgPipeline without hitting shape mismatches and crashes.
Describe the solution you'd like.
I would like to add a dedicated Flux2KleinImg2ImgPipeline. This pipeline will:
- Adapt standard
Img2Img logic (calculating sliced timesteps and scaling noise via FlowMatchEulerDiscreteScheduler) to the specific packing constraints of the Klein architecture.
- Maintain Klein-specific safety optimizations, such as area-based image resizing (capping at 1024x1024) to prevent OOM errors on consumer hardware.
- Include standard pipeline safety checks, such as
strength boundary validation and batch-size divisibility checks.
Describe alternatives you've considered.
- Alternative 1: Modifying the base
Flux2KleinPipeline to handle both T2I and I2I. This was rejected because diffusers design philosophy strongly prefers keeping pipelines atomic and focused for readability and maintainability.
- Alternative 2: Routing users to the base
FluxImg2ImgPipeline. This was rejected because the architectural differences (e.g., dual vs. single text encoders, differing vae_scale_factors) make them fundamentally incompatible without heavy conditional logic.
Additional context.
I have already implemented this pipeline locally. The matrix math, packing/unpacking dimension integrity, and strength validations have been successfully verified using isolated CPU mock tests. I will open a Pull Request resolving this issue shortly!
Is your feature request related to a problem? Please describe.
Currently, the
diffuserslibrary supports the base text-to-imageFlux2KleinPipeline, but it lacks native support for Image-to-Image generation (Img2Img) for the FLUX.2 Klein architecture. Because Klein uses a highly optimized, compact structure (single text encoder, specific VAE patchification, and built-in batch normalization), users cannot simply drop Klein weights into the standardFluxImg2ImgPipelinewithout hitting shape mismatches and crashes.Describe the solution you'd like.
I would like to add a dedicated
Flux2KleinImg2ImgPipeline. This pipeline will:Img2Imglogic (calculating sliced timesteps and scaling noise viaFlowMatchEulerDiscreteScheduler) to the specific packing constraints of the Klein architecture.strengthboundary validation and batch-size divisibility checks.Describe alternatives you've considered.
Flux2KleinPipelineto handle both T2I and I2I. This was rejected becausediffusersdesign philosophy strongly prefers keeping pipelines atomic and focused for readability and maintainability.FluxImg2ImgPipeline. This was rejected because the architectural differences (e.g., dual vs. single text encoders, differingvae_scale_factors) make them fundamentally incompatible without heavy conditional logic.Additional context.
I have already implemented this pipeline locally. The matrix math, packing/unpacking dimension integrity, and strength validations have been successfully verified using isolated CPU mock tests. I will open a Pull Request resolving this issue shortly!