Skip to content

Latest commit

 

History

History
62 lines (42 loc) · 2.97 KB

File metadata and controls

62 lines (42 loc) · 2.97 KB

Flux2

LoRA MPS

Flux.2 is the recent series of image generation models from Black Forest Labs, preceded by the Flux.1 series. It is an entirely new model with a new architecture and pre-training done from scratch!

Original model checkpoints for Flux can be found here. Original inference code can be found here.

Tip

Flux2 can be quite expensive to run on consumer hardware devices. However, you can perform a suite of optimizations to run it faster and in a more memory-friendly manner. Check out this section for more details. Additionally, Flux can benefit from quantization for memory efficiency with a trade-off in inference latency. Refer to this blog post to learn more.

Caching may also speed up inference by storing and reusing intermediate outputs.

Caption upsampling

Flux.2 can potentially generate better better outputs with better prompts. We can "upsample" an input prompt by setting the caption_upsample_temperature argument in the pipeline call arguments. The official implementation recommends this value to be 0.15.

Reference conditioning vs. img2img

The image argument on [Flux2Pipeline] and [Flux2KleinPipeline] is a reference conditioning. Reference images are encoded as additional attention tokens that flow through the transformer alongside the text prompt. Flux.2 doesn't add noise to the input image unlike [FluxImg2ImgPipeline]. Passing strength to [Flux2Pipeline] raises:

TypeError: Flux2Pipeline.__call__() got an unexpected keyword argument 'strength'

Drop the strength argument and pass references with image. For inpainting, use [Flux2KleinInpaintPipeline] instead.

Flux2Pipeline

[[autodoc]] Flux2Pipeline - all - call

Flux2KleinPipeline

[[autodoc]] Flux2KleinPipeline - all - call

Flux2KleinKVPipeline

[[autodoc]] Flux2KleinKVPipeline - all - call