Emilio407's picture
Upload README.md with huggingface_hub
7a84461 verified
|
Raw
History Blame Contribute Delete
2.56 kB
metadata
license: mit
base_model:
  - black-forest-labs/FLUX.2-klein-4B
  - openbmb/MiniCPM5-1B
  - black-forest-labs/FLUX.2-small-decoder
tags:
  - flux
  - flux2
  - distillation
  - lora
  - text-to-image
  - diffusers
library_name: diffusers
pipeline_tag: text-to-image

flux2tiny — Distilled FLUX.2-klein-4B with MiniCPM5-1B Text Encoder

This repository contains the trained adapter and LoRA weights for flux2tiny, a distilled version of FLUX.2-klein-4B that replaces the 4B-parameter Qwen3-4B text encoder with MiniCPM5-1B (1.08B parameters).

What's in this repo

File Size Description
adapter.safetensors ~23 MB Projection adapter (3× Linear 1536→2560, concatenated to 7680)
transformer_lora/adapter_model.safetensors ~7.5 MB PEFT LoRA weights (rank 16) for Flux2Transformer2DModel
transformer_lora/adapter_config.json ~1 KB PEFT LoRA configuration

Required base models (downloaded automatically)

Usage

# Clone the code repo
# git clone https://github.com/ElMiloPy/flux2tiny.git

from pipeline import Flux2TinyPipeline

pipe = Flux2TinyPipeline(
    adapter_path="path/to/adapter.safetensors",
    lora_path="path/to/transformer_lora",
)

image = pipe("A cat sitting on a windowsill at sunset", height=512, width=512)
image.save("output.png")

Or via CLI:

python generate.py "A cat sitting on a windowsill at sunset" \
    --adapter path/to/adapter.safetensors \
    --lora path/to/transformer_lora \
    --size 512x512

Training details

Trained via a 3-stage knowledge distillation pipeline:

  1. Adapter pre-training — MSE alignment between MiniCPM5-1B and Qwen3-4B hidden states
  2. Teacher latent generation — 15,000 latent-prompt pairs from the original FLUX.2 pipeline
  3. Flow Matching LoRA distillation — Joint training of adapter + transformer LoRA on teacher latents

See github.com/ElMiloPy/flux2tiny for full details.

License

  • These weights: MIT
  • FLUX.2-klein-4B: Apache 2.0
  • MiniCPM5-1B: Apache 2.0