Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

15.7 KB
Raw Blame
"""FLUX.1 starter models."""

from invokeai.backend.model_manager.starter_models.common import (
    TINY_AUTOENCODER_NOTE,
    clip_l_encoder,
    clip_vit_l_image_encoder,
    gemma2_2b_encoder,
    siglip,
    t5_8b_quantized_encoder,
    t5_base_encoder,
)
from invokeai.backend.model_manager.starter_models.types import StarterModel
from invokeai.backend.model_manager.taxonomy import (
    BaseModelType,
    ModelFormat,
    ModelType,
    PiDDecoderVariantType,
)

flux_vae = StarterModel(
    source_urls=["https://huggingface.co/black-forest-labs/FLUX.1-schnell"],
    name="FLUX.1-schnell_ae",
    base=BaseModelType.Flux,
    source="black-forest-labs/FLUX.1-schnell::ae.safetensors",
    description="FLUX VAE compatible with both schnell and dev variants.",
    type=ModelType.VAE,
)

taef1 = StarterModel(
    source_urls=["https://huggingface.co/madebyollin/taef1"],
    name="TAEF1 (FLUX.1 preview decoder)",
    base=BaseModelType.Flux,
    source="https://huggingface.co/madebyollin/taef1/resolve/b1b2d00e9e440cfbf3dedb34266864da86016ceb/diffusion_pytorch_model.safetensors",
    description=f"Sharp live previews for FLUX.1 and Z-Image. {TINY_AUTOENCODER_NOTE} ~10MB",
    type=ModelType.TinyAutoencoder,
    format=ModelFormat.Checkpoint,
)

# NVIDIA PiD decoders (https://huggingface.co/nvidia/PiD). Code is Apache-2.0; weights are NSCLv1 (non-commercial /
# research). Each is a 4x super-resolution decoder that replaces the regular VAE decode and needs the Gemma-2 encoder.
pid_decoder_flux_2k = StarterModel(
    source_urls=["https://huggingface.co/nvidia/PiD"],
    name="PiD Decoder FLUX (2K)",
    base=BaseModelType.Flux,
    source="nvidia/PiD::checkpoints/PiD_res2k_sr4x_official_flux_distill_4step/model_ema_bf16.pth",
    description="NVIDIA PiD 4x super-resolution decoder for FLUX latents, 2K target preset (e.g. 512 -> 2048). ~5GB",
    type=ModelType.PiDDecoder,
    format=ModelFormat.Checkpoint,
    variant=PiDDecoderVariantType.Res2k_Sr4x,
    dependencies=[gemma2_2b_encoder],
)

pid_decoder_flux_2kto4k = StarterModel(
    source_urls=["https://huggingface.co/nvidia/PiD"],
    name="PiD Decoder FLUX (2K to 4K)",
    base=BaseModelType.Flux,
    source="nvidia/PiD::checkpoints_deprecated/PiD_res2kto4k_sr4x_official_flux_distill_4step/model_ema_bf16.pth",
    description="NVIDIA PiD 4x super-resolution decoder for FLUX latents, 2K-to-4K preset (first-generation architecture; see PiD 1.5 for the newer one). ~5GB",
    type=ModelType.PiDDecoder,
    format=ModelFormat.Checkpoint,
    variant=PiDDecoderVariantType.Res2kTo4k_Sr4x,
    dependencies=[gemma2_2b_encoder],
)

# Comfy-Org's single-file builds of PiD 1.5, pinned to a commit. Only the 4-step (distilled) files: the repo's
# names without `_4step` are the undistilled teachers, which the config refuses.
pid_1_5_decoder_flux_2kto4k = StarterModel(
    source_urls=["https://huggingface.co/Comfy-Org/PixelDiT"],
    name="PiD 1.5 Decoder FLUX (2K to 4K)",
    base=BaseModelType.Flux,
    source="https://huggingface.co/Comfy-Org/PixelDiT/resolve/f1aa9118da0a0b53a4433e5de9a4de2e9aae2193/diffusion_models/pid_1.5_flux1_1024_to_4096_4step_bf16.safetensors",
    description="NVIDIA PiD 1.5 4x super-resolution decoder for FLUX latents, 2K-to-4K preset, in Comfy-Org's single-file build. ~2.8GB",
    type=ModelType.PiDDecoder,
    format=ModelFormat.Checkpoint,
    variant=PiDDecoderVariantType.Res2kTo4k_Sr4x,
    dependencies=[gemma2_2b_encoder],
)

pid_1_5_decoder_flux_2kto4k_int8 = StarterModel(
    source_urls=["https://huggingface.co/Comfy-Org/PixelDiT"],
    name="PiD 1.5 Decoder FLUX (2K to 4K, int8)",
    base=BaseModelType.Flux,
    source="https://huggingface.co/Comfy-Org/PixelDiT/resolve/f1aa9118da0a0b53a4433e5de9a4de2e9aae2193/diffusion_models/pid_1.5_flux1_1024_to_4096_4step_int8_convrot.safetensors",
    description="PiD 1.5 FLUX decoder in Comfy-Org's int8_convrot build: its transformer layers stay int8, about 2GB once loaded instead of 5.6GB. ~1.6GB",
    type=ModelType.PiDDecoder,
    format=ModelFormat.Checkpoint,
    variant=PiDDecoderVariantType.Res2kTo4k_Sr4x,
    dependencies=[gemma2_2b_encoder],
)

# region: Main
flux_schnell_quantized = StarterModel(
    source_urls=[
        "https://huggingface.co/InvokeAI/flux_schnell",
        "https://huggingface.co/black-forest-labs/FLUX.1-schnell",
    ],
    name="FLUX.1 schnell (quantized)",
    base=BaseModelType.Flux,
    source="InvokeAI/flux_schnell::transformer/bnb_nf4/flux1-schnell-bnb_nf4.safetensors",
    description="FLUX schnell transformer quantized to bitsandbytes NF4 format. Total size with dependencies: ~12GB",
    type=ModelType.Main,
    dependencies=[t5_8b_quantized_encoder, flux_vae, clip_l_encoder],
)

flux_dev_quantized = StarterModel(
    source_urls=["https://huggingface.co/InvokeAI/flux_dev"],
    name="FLUX.1 dev (quantized)",
    base=BaseModelType.Flux,
    source="InvokeAI/flux_dev::transformer/bnb_nf4/flux1-dev-bnb_nf4.safetensors",
    description="FLUX dev transformer quantized to bitsandbytes NF4 format. Total size with dependencies: ~12GB",
    type=ModelType.Main,
    dependencies=[t5_8b_quantized_encoder, flux_vae, clip_l_encoder],
)

flux_schnell = StarterModel(
    source_urls=[
        "https://huggingface.co/InvokeAI/flux_schnell",
        "https://huggingface.co/black-forest-labs/FLUX.1-schnell",
    ],
    name="FLUX.1 schnell",
    base=BaseModelType.Flux,
    source="InvokeAI/flux_schnell::transformer/base/flux1-schnell.safetensors",
    description="FLUX schnell transformer in bfloat16. Total size with dependencies: ~33GB",
    type=ModelType.Main,
    dependencies=[t5_base_encoder, flux_vae, clip_l_encoder],
)

# A community repack -- neither BFL nor Comfy-Org publishes an int8 build of FLUX.1. Pinned to a
# commit rather than `main`, which here is a correctness matter and not just reproducibility: the
# decode follows the file's own `comfy_quant` marker, which says `convrot: true` at group size 256.
# A reupload at the same path that changed or dropped that flag would be derotated wrongly, and the
# result loads cleanly, logs its layer count and generates noise.
flux_dev_int8 = StarterModel(
    source_urls=["https://huggingface.co/AX1Y2JP/FLUX.1-dev-INT8-ConvRot"],
    name="FLUX.1 dev (int8)",
    base=BaseModelType.Flux,
    source="https://huggingface.co/AX1Y2JP/FLUX.1-dev-INT8-ConvRot/resolve/01a17db182d52088b222d615ce54729fa090b378/flux1-dev-int8-convrot.safetensors",
    description="FLUX dev transformer in ComfyUI int8_tensorwise, from a community repack (no "
    "first-party int8 build of FLUX.1 exists). Half the memory of the bfloat16 transformer at 8 bits "
    "per weight, on every supported GPU - FLUX.1 dev (quantized) is smaller still, at 4. Total size "
    "with dependencies: ~18GB",
    type=ModelType.Main,
    dependencies=[t5_8b_quantized_encoder, flux_vae, clip_l_encoder],
)

# Kijai's plain e4m3fn casts: the weights are stored in fp8 without per-tensor scales.
flux_schnell_fp8 = StarterModel(
    source_urls=["https://huggingface.co/Kijai/flux-fp8", "https://huggingface.co/black-forest-labs/FLUX.1-schnell"],
    name="FLUX.1 schnell (fp8)",
    base=BaseModelType.Flux,
    source="https://huggingface.co/Kijai/flux-fp8/resolve/2ef6f85f9f4b94634f995ba0bfa84fd3ab865c1d/"
    "flux1-schnell-fp8-e4m3fn.safetensors",
    description="FLUX schnell transformer in Kijai's fp8 (e4m3fn) cast, about half the size of the bfloat16 "
    "transformer. FP8 Storage is switched on when it is installed. ~11.9GB; total size with dependencies: ~22GB",
    type=ModelType.Main,
    dependencies=[t5_base_encoder, flux_vae, clip_l_encoder],
)

flux_dev_fp8 = StarterModel(
    source_urls=["https://huggingface.co/Kijai/flux-fp8"],
    name="FLUX.1 dev (fp8)",
    base=BaseModelType.Flux,
    source="https://huggingface.co/Kijai/flux-fp8/resolve/2ef6f85f9f4b94634f995ba0bfa84fd3ab865c1d/"
    "flux1-dev-fp8-e4m3fn.safetensors",
    description="FLUX dev transformer in Kijai's fp8 (e4m3fn) cast, about half the size of the bfloat16 "
    "transformer. FP8 Storage is switched on when it is installed. ~11.9GB; total size with dependencies: ~22GB",
    type=ModelType.Main,
    dependencies=[t5_base_encoder, flux_vae, clip_l_encoder],
)

flux_dev = StarterModel(
    source_urls=["https://huggingface.co/InvokeAI/flux_dev"],
    name="FLUX.1 dev",
    base=BaseModelType.Flux,
    source="InvokeAI/flux_dev::transformer/base/flux1-dev.safetensors",
    description="FLUX dev transformer in bfloat16. Total size with dependencies: ~33GB",
    type=ModelType.Main,
    dependencies=[t5_base_encoder, flux_vae, clip_l_encoder],
)

flux_schnell_sdnq = StarterModel(
    source_urls=[
        "https://huggingface.co/Disty0/FLUX.1-schnell-SDNQ-uint4-svd-r32",
        "https://huggingface.co/black-forest-labs/FLUX.1-schnell",
    ],
    name="FLUX.1 schnell (SDNQ uint4 + SVD)",
    base=BaseModelType.Flux,
    source="Disty0/FLUX.1-schnell-SDNQ-uint4-svd-r32",
    description="FLUX.1 schnell quantized via SDNQ to uint4 + SVD rank 32. Full self-contained "
    "Flux pipeline (transformer + T5 + CLIP + VAE). ~15GB",
    type=ModelType.Main,
    format=ModelFormat.SDNQQuantized,
)

flux_kontext = StarterModel(
    source_urls=["https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev"],
    name="FLUX.1 Kontext dev",
    base=BaseModelType.Flux,
    source="https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev/resolve/main/flux1-kontext-dev.safetensors",
    description="FLUX.1 Kontext dev transformer in bfloat16. Total size with dependencies: ~33GB",
    type=ModelType.Main,
    dependencies=[t5_base_encoder, flux_vae, clip_l_encoder],
)

flux_kontext_quantized = StarterModel(
    source_urls=[
        "https://huggingface.co/unsloth/FLUX.1-Kontext-dev-GGUF",
        "https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev",
    ],
    name="FLUX.1 Kontext dev (quantized)",
    base=BaseModelType.Flux,
    source="https://huggingface.co/unsloth/FLUX.1-Kontext-dev-GGUF/resolve/main/flux1-kontext-dev-Q4_K_M.gguf",
    description="FLUX.1 Kontext dev quantized (q4_k_m). Total size with dependencies: ~12GB",
    type=ModelType.Main,
    dependencies=[t5_8b_quantized_encoder, flux_vae, clip_l_encoder],
)

flux_kontext_fp8 = StarterModel(
    source_urls=[
        "https://huggingface.co/Comfy-Org/flux1-kontext-dev_ComfyUI",
        "https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev",
    ],
    name="FLUX.1 Kontext dev (fp8)",
    base=BaseModelType.Flux,
    source="https://huggingface.co/Comfy-Org/flux1-kontext-dev_ComfyUI/resolve/795e390e4a1200720e40af3780d5d8b96bc13ae3/"
    "split_files/diffusion_models/flux1-dev-kontext_fp8_scaled.safetensors",
    description="FLUX.1 Kontext dev transformer in Comfy-Org's scaled fp8 build, about half the size of the "
    "bfloat16 transformer. FP8 Storage is switched on when it is installed. ~11.9GB; total size with "
    "dependencies: ~22GB",
    type=ModelType.Main,
    dependencies=[t5_base_encoder, flux_vae, clip_l_encoder],
)

flux_krea = StarterModel(
    source_urls=["https://huggingface.co/InvokeAI/FLUX.1-Krea-dev"],
    name="FLUX.1 Krea dev",
    base=BaseModelType.Flux,
    source="https://huggingface.co/InvokeAI/FLUX.1-Krea-dev/resolve/main/flux1-krea-dev.safetensors",
    description="FLUX.1 Krea dev. Total size with dependencies: ~29GB",
    type=ModelType.Main,
    dependencies=[t5_8b_quantized_encoder, flux_vae, clip_l_encoder],
)

flux_krea_quantized = StarterModel(
    source_urls=["https://huggingface.co/InvokeAI/FLUX.1-Krea-dev-GGUF"],
    name="FLUX.1 Krea dev (quantized)",
    base=BaseModelType.Flux,
    source="https://huggingface.co/InvokeAI/FLUX.1-Krea-dev-GGUF/resolve/main/flux1-krea-dev-Q4_K_M.gguf",
    description="FLUX.1 Krea dev quantized (q4_k_m). Total size with dependencies: ~12GB",
    type=ModelType.Main,
    dependencies=[t5_8b_quantized_encoder, flux_vae, clip_l_encoder],
)

flux_krea_fp8 = StarterModel(
    source_urls=["https://huggingface.co/Comfy-Org/Flux-1-Krea-Dev"],
    name="FLUX.1 Krea dev (fp8)",
    base=BaseModelType.Flux,
    source="https://huggingface.co/Comfy-Org/Flux-1-Krea-Dev/resolve/d9d7c421e64d3a80b16a79c0fdc9989bfdaa6f01/split_files/diffusion_models/flux1-krea-dev_fp8_scaled.safetensors",
    description="FLUX.1 Krea dev transformer in Comfy-Org's scaled fp8 build. FP8 Storage is switched on when it is "
    "installed, so its fp8 layers stay fp8, about 11.9GB once loaded. ~11.9GB; total size with dependencies: ~18GB",
    type=ModelType.Main,
    dependencies=[t5_8b_quantized_encoder, flux_vae, clip_l_encoder],
)

# A community repack, pinned to a commit for the same reason as FLUX.1 dev (int8) above: the decode follows the
# file's own `comfy_quant` marker, and a reupload at the same path could change what that marker says.
flux_krea_int8 = StarterModel(
    source_urls=["https://huggingface.co/rockerBOO/flux.1-krea-dev-convrot-int8"],
    name="FLUX.1 Krea dev (int8)",
    base=BaseModelType.Flux,
    source="https://huggingface.co/rockerBOO/flux.1-krea-dev-convrot-int8/resolve/b1487ea0f81f052852e9230537baefee8c2f73d6/flux1-krea-dev-int8convrot.safetensors",
    description="FLUX.1 Krea dev transformer in ComfyUI int8_convrot, from rockerBOO's community repack (no "
    "first-party int8 build of FLUX.1 exists). Its int8 layers stay int8 on every supported GPU, about 14.1GB once "
    "loaded; int8 Compute can run them on NVIDIA int8 tensor cores. ~14.1GB; total size with dependencies: ~20GB",
    type=ModelType.Main,
    dependencies=[t5_8b_quantized_encoder, flux_vae, clip_l_encoder],
)

ip_adapter_flux = StarterModel(
    source_urls=["https://huggingface.co/XLabs-AI/flux-ip-adapter-v2"],
    name="Standard Reference (XLabs FLUX IP-Adapter v2)",
    base=BaseModelType.Flux,
    source="https://huggingface.co/XLabs-AI/flux-ip-adapter-v2/resolve/main/ip_adapter.safetensors",
    description="References images with a more generalized/looser degree of precision.",
    type=ModelType.IPAdapter,
    dependencies=[clip_vit_l_image_encoder],
)

union_cnet_flux = StarterModel(
    source_urls=["https://huggingface.co/InstantX/FLUX.1-dev-Controlnet-Union"],
    name="FLUX.1-dev-Controlnet-Union",
    base=BaseModelType.Flux,
    source="InstantX/FLUX.1-dev-Controlnet-Union",
    description="A unified ControlNet for FLUX.1-dev model that supports 7 control modes, including canny (0), tile (1), depth (2), blur (3), pose (4), gray (5), low quality (6)",
    type=ModelType.ControlNet,
)

# endregion
# region Control LoRA
flux_canny_control_lora = StarterModel(
    source_urls=["https://huggingface.co/black-forest-labs/FLUX.1-Canny-dev-lora"],
    name="Hard Edge Detection (Canny)",
    base=BaseModelType.Flux,
    source="black-forest-labs/FLUX.1-Canny-dev-lora::flux1-canny-dev-lora.safetensors",
    description="Uses detected edges in the image to control composition.",
    type=ModelType.ControlLoRa,
)

flux_depth_control_lora = StarterModel(
    source_urls=["https://huggingface.co/black-forest-labs/FLUX.1-Depth-dev-lora"],
    name="Depth Map",
    base=BaseModelType.Flux,
    source="black-forest-labs/FLUX.1-Depth-dev-lora::flux1-depth-dev-lora.safetensors",
    description="Uses depth information in the image to control the depth in the generation.",
    type=ModelType.ControlLoRa,
)

# region FLUX Redux
flux_redux = StarterModel(
    source_urls=["https://huggingface.co/black-forest-labs/FLUX.1-Redux-dev"],
    name="FLUX Redux",
    base=BaseModelType.Flux,
    source="black-forest-labs/FLUX.1-Redux-dev::flux1-redux-dev.safetensors",
    description="FLUX Redux model (for image variation).",
    type=ModelType.FluxRedux,
    dependencies=[siglip],
)

# region FLUX Fill
flux_fill = StarterModel(
    source_urls=["https://huggingface.co/black-forest-labs/FLUX.1-Fill-dev"],
    name="FLUX Fill",
    base=BaseModelType.Flux,
    source="black-forest-labs/FLUX.1-Fill-dev::flux1-fill-dev.safetensors",
    description="FLUX Fill model (for inpainting).",
    type=ModelType.Main,
)