# FLUX.2 & Klein 9B RefMods (Reference Latent Adapters) Open research, architecture documentation, and implementation repository for **FLUX.2 & Klein 9B RefMods**. - **Interactive Model Browser:** [https://huggingface.co/spaces/malcolmrey/browser](https://huggingface.co/spaces/malcolmrey/browser) (Search & visually explore 1,400+ characters, celebrities, and concepts) - **Model Weights Hub:** [https://huggingface.co/malcolmrey/klein9](https://huggingface.co/malcolmrey/klein9) (1,400+ pre-extracted `.safetensors` models) - **ComfyUI Custom Node:** [github.com/malcolmamal/ComfyUI-Flux2Klein9Mod](https://github.com/malcolmamal/ComfyUI-Flux2Klein9Mod) - **CLI Generator & Batch Extractor:** [`generate_flux2_klein9_refmod.py`](generate_flux2_klein9_refmod.py) - **Official Workflows:** [`workflows/`](workflows/) ([`workflow_klein9_refmod.json`](workflows/workflow_klein9_refmod.json) & [`workflow_klein9_refmod_lora.json`](workflows/workflow_klein9_refmod_lora.json)) - **Target Models:** FLUX.2, Klein 4B, Klein 8B, Klein 9B --- ## 📁 Repository Structure ```text klein9/ ├── generate_flux2_klein9_refmod.py <── CLI Generator & Mass Batch Extractor Tool ├── workflows/ <── Mirrored Production Workflows │ ├── workflow_klein9_refmod.json <── Pure RefMod Text-to-Image Workflow │ └── workflow_klein9_refmod_lora.json <── Hybrid RefMod + LoRA Power Stack Workflow ├── docs/ │ ├── README.md <── Documentation Index │ ├── FLUX2_KLEIN9_REFMODS_GUIDE.md <── Complete Architecture, Extraction & Usage Guide │ ├── VISUAL_BENCHMARKS_AND_COMPARISONS.md <── 5-Column Visual Benchmarks & Single Run Links │ └── examples/ <── Benchmark Grids & Single Run Artifacts (PNGs) └── comfyui/ └── custom_nodes/ └── ComfyUI-Flux2Klein9Mod/ <── Full ComfyUI Custom Node Package ``` --- ## 🚀 Quickstart ### 1. Install ComfyUI Custom Node ```bash cd ComfyUI/custom_nodes git clone https://github.com/malcolmamal/ComfyUI-Flux2Klein9Mod.git ``` ### 2. Discover & Download RefMods Search and find any character, celebrity, or concept `.safetensors` in the [Malcolmrey Browser Space](https://huggingface.co/spaces/malcolmrey/browser) or directly on the [Hugging Face Hub](https://huggingface.co/malcolmrey/klein9), then place the file into: ```text ComfyUI/models/refmods-klein9/ ``` ### 3. Load Ready-to-Use Workflows Load either of the official JSON workflows located in [`workflows/`](workflows/): - **[`workflow_klein9_refmod.json`](workflows/workflow_klein9_refmod.json):** Pure RefMod Text-to-Image generation for FLUX.2 / Klein 9B. - **[`workflow_klein9_refmod_lora.json`](workflows/workflow_klein9_refmod_lora.json):** Hybrid RefMod + LoRA Power Stack. ### 4. Extract Custom RefMods from Datasets Use the included generator script [`generate_flux2_klein9_refmod.py`](generate_flux2_klein9_refmod.py): ```bash # Extract single dataset by name or path python generate_flux2_klein9_refmod.py C:/Development/ai-toolkit/datasets/your_character --token-budget 1024 # Preview media discovered without encoding python generate_flux2_klein9_refmod.py your_character --dry-run # Mass batch extract all datasets in directory python generate_flux2_klein9_refmod.py --all --datasets-root C:/Development/ai-toolkit/datasets ``` --- ## 📖 Complete Documentation & Visual Studies - **[Interactive Model Browser](https://huggingface.co/spaces/malcolmrey/browser)**: Live visual model finder with search and filter capabilities. - **[FLUX.2 & Klein 9B RefMods Architecture Guide](docs/FLUX2_KLEIN9_REFMODS_GUIDE.md)**: Node specifications, graph wiring diagrams, token budget configurations, and extraction mechanics. - **[Visual Benchmarks & 5-Column Comparison Studies](docs/VISUAL_BENCHMARKS_AND_COMPARISONS.md)**: Side-by-side empirical visual comparisons (Pure LoRA vs 8-Raw Reference vs Pure RefMod vs Hybrid stack) with direct links to high-res single runs and model weights on Hugging Face. - **[CLI Generator Script](generate_flux2_klein9_refmod.py)**: Source code for dataset pre-encoding and batch processing.