F L U X.1 Fill dev

black-forest-labs

Introduction

FLUX.1 Fill [dev] is a 12 billion parameter rectified flow transformer designed to fill areas in images based on text descriptions. It offers high-quality outputs suitable for various applications, including personal, scientific, and commercial use under the FLUX.1 [dev] Non-Commercial License.

Architecture

The model blends prompt following with image structure completion and is trained using guidance distillation, enhancing its efficiency. It is built to drive scientific research and creative workflows by offering open weights for developers and artists.

Training

FLUX.1 Fill [dev] uses guidance distillation for efficient training, optimizing its ability to generate high-quality image completions based on textual prompts.

Guide: Running Locally

  1. Install Diffusers Library
    Upgrade or install the diffusers library:

    pip install -U diffusers
    
  2. Use FluxFillPipeline
    Implement the model using the following Python script:

    import torch
    from diffusers import FluxFillPipeline
    from diffusers.utils import load_image
    
    image = load_image("https://huggingface.co/datasets/diffusers/diffusers-images-docs/resolve/main/cup.png")
    mask = load_image("https://huggingface.co/datasets/diffusers/diffusers-images-docs/resolve/main/cup_mask.png")
    
    pipe = FluxFillPipeline.from_pretrained("black-forest-labs/FLUX.1-Fill-dev", torch_dtype=torch.bfloat16).to("cuda")
    image = pipe(
        prompt="a white paper cup",
        image=image,
        mask_image=mask,
        height=1632,
        width=1232,
        guidance_scale=30,
        num_inference_steps=50,
        max_sequence_length=512,
        generator=torch.Generator("cpu").manual_seed(0)
    ).images[0]
    image.save(f"flux-fill-dev.png")
    
  3. Cloud GPU Suggestion
    For better performance, use a cloud GPU service such as AWS, Google Cloud, or Azure.

License

The model is released under the FLUX-1-dev-non-commercial-license. For more details, view the license agreement and the acceptable use policy.

More Related APIs