Krea 2 is licensed under the Krea 2 Community License Agreement.
For more information, visit https://krea.ai/krea-2-licensing.

------------------------------------------------------------------------
This repository contains a MODIFIED DERIVATIVE of the Krea Model
(krea/Krea-2-Turbo). Modifications by avlp12 (ALISVOLATPROPRIIS):

  - Re-implementation of the Krea 2 Turbo transformer, Qwen3-VL-4B text
    encoder, and flow-matching sampler for Apple MLX.
  - 8-bit (group-size 64) quantization of the transformer's 28
    attention + SwiGLU blocks (sensitivity-graded; all other paths bf16).

This is an independent, unofficial port. It is NOT an official Krea
product and is NOT endorsed by or affiliated with Krea.ai, Inc.

A full copy of the Krea 2 Community License Agreement is included in the
LICENSE file in this repository. Your use of these weights is governed by
that agreement (including, e.g., the < $1,000,000 USD annual-revenue
threshold for Commercial Use and the content-filtering requirements).
------------------------------------------------------------------------

------------------------------------------------------------------------
FURTHER MODIFICATIONS in the krea2-mlx-studio fork, by Casey Thomas
(github.com/Cthomasdesign):

  - LoRA support: a runtime low-rank adapter applied to the (quantized)
    transformer (krea2/lora.py), Krea2Pipeline.set_loras(), CLI flags,
    and web-UI controls. The key-mapper handles both the official Krea /
    diffusers and the ai-toolkit / PEFT LoRA naming conventions.

This fork is independent and unofficial. It is NOT endorsed by or
affiliated with avlp12 (ALISVOLATPROPRIIS) or Krea.ai, Inc.
------------------------------------------------------------------------

------------------------------------------------------------------------
FURTHER MODIFICATIONS in this repository (ComfyUI-Krea2-MLX), by Casey
Thomas (github.com/Cthomasdesign):

  - The `krea2` engine (transformer, text encoder, sampler, LoRA, safety
    filter) is VENDORED into this repository as `krea2_engine/`, so this
    node package has no external git dependency on krea2-mlx-studio.
    The unused HF-Transformers-based text encoder variant
    (text_encoder_hf.py) and the auto-download-by-precision helpers
    (BUILDS/resolve_weights) were dropped as dead code not used by the
    ComfyUI nodes, which always load an explicit local transformer file
    chosen via the model loader node.
  - Performance modifications to the vendored engine (v0.4.0):
    native grouped-query attention in the fused SDPA kernels (no K/V
    head repetition); step-invariant conditioning (text fusion, RoPE
    tables, attention masks) hoisted out of the denoising loop; padded
    text tokens trimmed before the DiT; dynamic-length text encoding
    (pad to longest-in-batch with preserved absolute RoPE positions);
    and a per-prompt embedding cache in the pipeline. Mathematically
    faithful to the reference computation (validated); note that the
    sequence-length changes alter bf16 kernel rounding order, so fixed
    seeds render equal-quality but not bit-identical images vs earlier
    versions. Set KREA2_EXACT_LEGACY=1 for the pre-0.4 exact behavior.
  - ComfyUI node wrappers (nodes.py): model loading from
    ComfyUI/models/krea2, LoRA stacking from ComfyUI/models/loras,
    generation with progress/cancel support, and memory unloading.

This integration is independent and unofficial. It is NOT endorsed by or
affiliated with avlp12 (ALISVOLATPROPRIIS) or Krea.ai, Inc.
------------------------------------------------------------------------
