Instructions to use Emilio407/flux2tiny-MiniCPM5-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Emilio407/flux2tiny-MiniCPM5-1B with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-4B,openbmb/MiniCPM5-1B,black-forest-labs/FLUX.2-small-decoder", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("Emilio407/flux2tiny-MiniCPM5-1B") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
| 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](https://huggingface.co/black-forest-labs/FLUX.2-klein-4B) | |
| that replaces the 4B-parameter Qwen3-4B text encoder with | |
| [MiniCPM5-1B](https://huggingface.co/openbmb/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) | |
| - [black-forest-labs/FLUX.2-klein-4B](https://huggingface.co/black-forest-labs/FLUX.2-klein-4B) β Transformer backbone | |
| - [openbmb/MiniCPM5-1B](https://huggingface.co/openbmb/MiniCPM5-1B) β Student text encoder | |
| - [black-forest-labs/FLUX.2-small-decoder](https://huggingface.co/black-forest-labs/FLUX.2-small-decoder) β VAE decoder | |
| ## Usage | |
| ```python | |
| # 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: | |
| ```bash | |
| 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](https://github.com/ElMiloPy/flux2tiny) for full details. | |
| ## License | |
| - **These weights**: MIT | |
| - **FLUX.2-klein-4B**: Apache 2.0 | |
| - **MiniCPM5-1B**: Apache 2.0 | |