FLUX.1 on HuggingFace

FLUX.1 on HuggingFace

FLUX.1 [schnell] is a state-of-the-art 12 billion parameter rectified flow transformer designed to convert text descriptions into high-quality images. For more details, please refer to blog post.

Key Features

  • Exceptional Output Quality: Offers cutting-edge image quality and precise prompt adherence, rivaling closed-source models.
  • Efficient Image Generation: Utilizes latent adversarial diffusion distillation to produce high-quality images in just 1 to 4 steps.
  • Open Access: Available under the Apache-2.0 license, FLUX.1 [schnell] can be used for personal, scientific, and commercial purposes.

Usage

We provide a reference implementation and sample code for FLUX.1 [schnell] in a dedicated GitHub repository. Developers and creatives interested in building upon FLUX.1 [schnell] should use this as a foundation.

API Endpoints

FLUX.1 models are accessible via API from the following platforms:

  • bfl.ml (currently FLUX.1 [pro])
  • replicate.com
  • fal.ai
  • mystic.ai

ComfyUI

FLUX.1 [schnell] is also available in ComfyUI for local inference, featuring a node-based workflow.

Diffusers Integration

To use FLUX.1 [schnell] with the 🧨 Diffusers Python library:

  1. Install or upgrade Diffusers:
   pip install -U diffusers
  1. Run the model with FluxPipeline:
   import torch
   from diffusers import FluxPipeline

   pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16)
   pipe.enable_model_cpu_offload() # Saves VRAM by offloading to CPU; omit if GPU power is sufficient

   prompt = "A cat holding a sign that says hello world"
   image = pipe(
       prompt,
       guidance_scale=0.0,
       num_inference_steps=4,
       max_sequence_length=256,
       generator=torch.Generator("cpu").manual_seed(0)
   ).images[0]
   image.save("flux-schnell.png")

For more information, consult the Diffusers documentation.

Limitations

  • Factual Accuracy: This model does not provide factual information.
  • Biases: As a statistical model, it may reflect societal biases.
  • Prompt Matching: The model may not always produce outputs that match the given prompts.
  • Prompt Influence: The quality of prompt adherence can vary based on prompting style.

Out-of-Scope Use

The model and its derivatives must not be used for:

  • Violating any applicable laws or regulations.
  • Exploiting, harming, or attempting to harm minors, including the solicitation or dissemination of child exploitative content.
  • Generating or spreading false information intended to harm others.
  • Generating or disseminating personal identifiable information that could be used to harm individuals.
  • Harassing, abusing, threatening, stalking, or bullying individuals or groups.
  • Creating non-consensual nudity or illegal pornographic content.
  • Fully automated decision-making that affects individuals’ legal rights or creates binding obligations.
  • Large-scale disinformation campaigns.

FLUX.1 on HuggingFace Repo

https://huggingface.co/black-forest-labs/FLUX.1-schnell/tree/main

Read other articles: