malcolmrey commited on
Commit
5671ca0
·
1 Parent(s): b019a05
README.md CHANGED
@@ -4,7 +4,9 @@ license: wtfpl
4
 
5
  # malcolmrey's Various AI Model, Architecture & Research Repository
6
 
7
- Welcome to the central research and asset repository of **malcolmrey**. This repository hosts cutting-edge tools, custom architectures, RefMod latent adapter systems, video synthesis engines, training configurations, benchmark suites, cinematic scripts, and comprehensive educational guides spanning **MiniMax-H3**, **FLUX.2 / Klein 9B**, **WAN 2.1**, **LTX-Video**, **Z-Image**, **SDXL**, and **Stable Diffusion**.
 
 
8
 
9
  ---
10
 
@@ -12,12 +14,13 @@ Welcome to the central research and asset repository of **malcolmrey**. This rep
12
 
13
  | Section / Directory | Focus Area & Description | Key Resources & Direct Links |
14
  | :--- | :--- | :--- |
15
- | 🎬 **[`h3-center/`](h3-center/)** | **MiniMax-H3 Video & Cinema Hub**<br>Complete prompt guides, RefMod stacking, hybrid LoRA+RefMod containers, 1,500+ character tests, and 9-episode Crossovers cinematic series. | • [Prompting Guide](h3-center/docs/MINIMAX_H3_PROMPTING_GUIDE.md)<br>• [RefMod Stacking Guide](h3-center/docs/MINIMAX_H3_REFMOD_STACKING_AND_MULTISUBJECT_GUIDE.md)<br>• [Hybrid LoRA+RefMod Guide](h3-center/docs/MINIMAX_H3_HYBRID_LORA_REFMOD_CONTAINERS_GUIDE.md)<br>• [Multistacking Benchmark Demos](h3-center/docs/multistacking/README.md)<br>• [Known Characters Usability Index](h3-center/known-characters/INDEX.md)<br>• [Crossovers Cinema Series](h3-center/crossovers/README.md) |
16
  | 🎨 **[`klein9/`](klein9/)** | **FLUX.2 & Klein 9B RefMods**<br>Instant reference latent adapter ecosystem, custom ComfyUI nodes, CLI batch extractor, and benchmark suites. | • [RefMod Architecture Guide](klein9/docs/FLUX2_KLEIN9_REFMODS_GUIDE.md)<br>• [ComfyUI Node](klein9/comfyui/custom_nodes/ComfyUI-Flux2Klein9Mod/)<br>• [Batch Extractor Tool](klein9/generate_flux2_klein9_refmod.py)<br>• [Workflows](klein9/workflows/) \| [Visual Benchmarks](klein9/docs/VISUAL_BENCHMARKS_AND_COMPARISONS.md) |
17
- | 👁️ **[`qwen/`](qwen/)** | **Qwen-Image 2.1 Multimodal Hub**<br>Vision-Language (Qwen3-VL) conditioning architecture, reference strategy analysis, identity transfer, and prompt engineering standards. | • [RefMod Compatibility & ViT Architecture](qwen/docs/QWEN_IMAGE_21_REFMOD_COMPATIBILITY_AND_VISION_ENCODER_ARCHITECTURE.md)<br>• [Reference Strategy & Prompting Guide](qwen/docs/QWEN_IMAGE_21_REFERENCE_STRATEGY_AND_PROMPTING_GUIDE.md)<br>• [LoRA Optimizer Benchmark (maltrainer)](qwen/docs/QWEN_IMAGE_21_LORA_OPTIMIZER_BENCHMARK.md)<br>• [Qwen Hub Overview](qwen/README.md) |
18
  | ⚡ **[`zimage-turbo-vs-base-training/`](zimage-turbo-vs-base-training/)** | **Z Image Base vs. Turbo Benchmark**<br>Head-to-head training comparison across OneTrainer, MalTrainer, and AI Toolkit with datasets and weights. | • [Benchmark Overview & Configs](zimage-turbo-vs-base-training/README.md)<br>• Datasets, AdamW/Prodigy configs, & `.safetensors` weights |
19
- | 🛠️ **[`training-scripts/`](training-scripts/)** | **Production Training Configs**<br>Ready-to-use recipes for OneTrainer, Musubi Tuner, AI Toolkit, and MalTrainer. | • [OneTrainer Templates](training-scripts/onetrainer/) (Ernie, FK9, Krea2)<br>• [Musubi Pipelines](training-scripts/musubi/) (Ernie, LTX23)<br>• [AI Toolkit](training-scripts/aitoolkit/) & [MalTrainer](training-scripts/maltrainer/) |
20
- | 🎥 **Sample Media & Benchmarks** | **Model Generation Sample Libraries**<br>High-fidelity outputs and verification test suites. | • [`ltx23-samples/`](ltx23-samples/) (20 LTX-Video 2.3 renders)<br>• [`ernie-samples/`](ernie-samples/) (`ernie-samples.zip`)<br>• [`samples/fk9/`](samples/fk9/) (Rose Byrne & Sydney Sweeney outputs) |
 
21
  | 📚 **Guides & Articles** | **Comprehensive Knowledge Base**<br>In-depth technical guides for model training, optimization, and prompt engineering. | • [WAN 2.1 LoRA Training Tutorial](tutorials/wan-21-lora-training.md)<br>• [CivitAI Articles Collection](articles.md) |
22
 
23
  ---
@@ -35,6 +38,8 @@ The **MiniMax-H3 Center** is an all-in-one research laboratory and production st
35
  - 🎵 **[Audio-Synchronized & C2V Music Videos Guide](h3-center/docs/MINIMAX_AUDIO_SYNC_AND_C2V_MUSIC_VIDEOS.md)**: Techniques for aligning video cadence and singing motion with pre-recorded vocal tracks.
36
  - ⚙️ **[RefMods Installation & Usage Guide](h3-center/docs/MINIMAX_H3_REFMODS_INSTALLATION_AND_USAGE_GUIDE.md)** & **[RefMod Creation Guide](h3-center/docs/MINIMAX_H3_REFMOD_CREATION_GUIDE.md)**: Step-by-step instructions for extracting RefMod `.safetensors` from images and loading them into ComfyUI pipelines.
37
  - ⚖️ **[RefMods vs. Reference Images Comparison](h3-center/docs/MINIMAX_REFMODS_VS_REFERENCE_IMAGES.md)**: Architectural analysis of speed, latent fidelity, and token efficiency comparing pre-computed RefMods against raw pixel reference workflows.
 
 
38
 
39
  ### 👥 Known Characters & Usability Database
40
  - 📊 **[Usability Index (INDEX.md)](h3-center/known-characters/INDEX.md)** & **[Unusable Index (INDEX_BAD.md)](h3-center/known-characters/INDEX_BAD.md)**: Empirical test results evaluating over **1,500+** characters, actors, and public figures directly in MiniMax-H3:
@@ -43,7 +48,7 @@ The **MiniMax-H3 Center** is an all-in-one research laboratory and production st
43
  - **Bad (920+ subjects):** Subjects that fail without custom LoRAs or dedicated RefMods.
44
 
45
  ### 🎥 Crossovers Episodic Cinema Series
46
- - 🍿 **[Crossovers Series Master Catalog](h3-center/crossovers/README.md)**: 9 full-length narrative episodes created with MiniMax-H3, complete with rendered `.mp4` video files, cast listings, and synopses:
47
  - **Episode 1:** *The Contagion of Secrets* (House, Monk, Dwight, Dexter, Malcolm Reynolds, Mulder, Penny)
48
  - **Episode 2:** *The Cosmic Extradition* (Dean Winchester, Mal Reynolds, Sherlock, Pam Beesly, Lucifer, 10th Doctor, Saul Goodman, Steve Rogers, John Locke, Tony Stark)
49
  - **Episode 3:** *Lockdown at Sabre Tower* (Michael Scott, Wednesday Addams, John McClane, Seeley Booth, James Bond, Steve Rogers, Elliot Alderson, Lucifer, Jack Bauer)
@@ -85,6 +90,14 @@ The **Qwen-Image 2.1 Hub** covers empirical research and architectural standards
85
  - Documents failure modes of multi-image referencing for single subjects (token dilution, feature blending).
86
  - Documents failure modes of 2x2 and 3x3 composite grids (grid leak, loss of high-frequency skin textures).
87
  - Provides master production prompt templates for precision face-swapping (preserving body, pose, age, skin pores, and clothing) and multi-character scenes.
 
 
 
 
 
 
 
 
88
 
89
  ---
90
 
@@ -107,14 +120,20 @@ Curated configurations for high-efficiency model training across popular trainer
107
  - 🟢 **[OneTrainer (`training-scripts/onetrainer/`)](training-scripts/onetrainer/)**:
108
  - `fk9_template.json` & `fk9_prodigy_template.json` — Klein 9B / FLUX.2 LoRA templates
109
  - `ernie_template.json` — Ernie training configuration
110
- - `krea2prodigy_template.json` — Krea 2 Prodigy training template
 
 
111
  - 🟣 **[Musubi Tuner (`training-scripts/musubi/`)](training-scripts/musubi/)**:
112
  - `musubi/ernie/` — Multi-resolution Ernie training scripts
113
  - `musubi/ltx23/` — LTX-Video 2.3 video model training configurations
114
  - 🔵 **[AI Toolkit (`training-scripts/aitoolkit/`)](training-scripts/aitoolkit/)**:
115
- - Config templates for WAN 2.1, Flux, and SDXL
116
- - 🟠 **[MalTrainer (`training-scripts/maltrainer/`)](training-scripts/maltrainer/)**:
117
- - Training configs for malcolmrey's proprietary trainer
 
 
 
 
118
 
119
  ---
120
 
@@ -124,6 +143,18 @@ Curated configurations for high-efficiency model training across popular trainer
124
  - 📦 **[`ernie-samples/`](ernie-samples/)**: Comprehensive benchmark sample package (`ernie-samples.zip`).
125
  - 🎬 **[`h3-center/crossovers/`](h3-center/crossovers/)**: 8 rendered `.mp4` full narrative crossover episodes.
126
  - 🎼 **[`h3-center/docs/multistacking/`](h3-center/docs/multistacking/)**: 8 dual-audio and counterpoint singing benchmark videos.
 
 
 
 
 
 
 
 
 
 
 
 
127
 
128
  ---
129
 
 
4
 
5
  # malcolmrey's Various AI Model, Architecture & Research Repository
6
 
7
+ Welcome to the central research and asset repository of **malcolmrey**. This repository hosts cutting-edge tools, custom architectures, RefMod latent adapter systems, video synthesis engines, training configurations, benchmark suites, cinematic scripts, and comprehensive educational guides spanning **MiniMax-H3**, **FLUX.2 / Klein 9B**, **Qwen-Image 2.1**, **WAN 2.1**, **LTX-Video**, **Z-Image**, **SDXL**, and **Stable Diffusion**.
8
+
9
+ Much of the training work here uses **[maltrainer](https://github.com/malcolmamal/maltrainer)**, malcolmrey's own LoRA trainer.
10
 
11
  ---
12
 
 
14
 
15
  | Section / Directory | Focus Area & Description | Key Resources & Direct Links |
16
  | :--- | :--- | :--- |
17
+ | 🎬 **[`h3-center/`](h3-center/)** | **MiniMax-H3 Video & Cinema Hub**<br>Complete prompt guides, RefMod stacking, hybrid LoRA+RefMod containers, identity-LoRA epoch sweeps, 1,500+ character tests, and 9-episode Crossovers cinematic series. | • [Prompting Guide](h3-center/docs/MINIMAX_H3_PROMPTING_GUIDE.md)<br>• [RefMod Stacking Guide](h3-center/docs/MINIMAX_H3_REFMOD_STACKING_AND_MULTISUBJECT_GUIDE.md)<br>• [Hybrid LoRA+RefMod Guide](h3-center/docs/MINIMAX_H3_HYBRID_LORA_REFMOD_CONTAINERS_GUIDE.md)<br>• [Jinx LoRA Epoch Sweep & RefMod Stack](h3-center/docs/lora/README.md)<br>• [Multistacking Benchmark Demos](h3-center/docs/multistacking/README.md)<br>• [Known Characters Usability Index](h3-center/known-characters/INDEX.md)<br>• [Crossovers Cinema Series](h3-center/crossovers/README.md) |
18
  | 🎨 **[`klein9/`](klein9/)** | **FLUX.2 & Klein 9B RefMods**<br>Instant reference latent adapter ecosystem, custom ComfyUI nodes, CLI batch extractor, and benchmark suites. | • [RefMod Architecture Guide](klein9/docs/FLUX2_KLEIN9_REFMODS_GUIDE.md)<br>• [ComfyUI Node](klein9/comfyui/custom_nodes/ComfyUI-Flux2Klein9Mod/)<br>• [Batch Extractor Tool](klein9/generate_flux2_klein9_refmod.py)<br>• [Workflows](klein9/workflows/) \| [Visual Benchmarks](klein9/docs/VISUAL_BENCHMARKS_AND_COMPARISONS.md) |
19
+ | 👁️ **[`qwen/`](qwen/)** | **Qwen-Image 2.1 Multimodal Hub**<br>Vision-Language (Qwen3-VL) conditioning architecture, reference strategy analysis, identity transfer, prompt engineering standards, edit samples, and a LoRA optimizer benchmark trained with maltrainer. | • [RefMod Compatibility & ViT Architecture](qwen/docs/QWEN_IMAGE_21_REFMOD_COMPATIBILITY_AND_VISION_ENCODER_ARCHITECTURE.md)<br>• [Reference Strategy & Prompting Guide](qwen/docs/QWEN_IMAGE_21_REFERENCE_STRATEGY_AND_PROMPTING_GUIDE.md)<br>• [LoRA Optimizer Benchmark (maltrainer)](qwen/docs/QWEN_IMAGE_21_LORA_OPTIMIZER_BENCHMARK.md)<br>• [Qwen Hub Overview](qwen/README.md) |
20
  | ⚡ **[`zimage-turbo-vs-base-training/`](zimage-turbo-vs-base-training/)** | **Z Image Base vs. Turbo Benchmark**<br>Head-to-head training comparison across OneTrainer, MalTrainer, and AI Toolkit with datasets and weights. | • [Benchmark Overview & Configs](zimage-turbo-vs-base-training/README.md)<br>• Datasets, AdamW/Prodigy configs, & `.safetensors` weights |
21
+ | 🛠️ **[`training-scripts/`](training-scripts/)** | **Production Training Configs**<br>Ready-to-use recipes for OneTrainer, Musubi Tuner, AI Toolkit, and MalTrainer. | • [OneTrainer Templates](training-scripts/onetrainer/) (Ernie, FK9, Krea2, SDXL, Z-Image)<br>• [Musubi Pipelines](training-scripts/musubi/) (Ernie, LTX23)<br>• [AI Toolkit](training-scripts/aitoolkit/) (FK9, Ideogram 4, WAN, Z-Image)<br>• [MalTrainer](training-scripts/maltrainer/) (Qwen-Image 2.1, Z-Image) |
22
+ | 🎥 **Sample Media & Benchmarks** | **Model Generation Sample Libraries**<br>High-fidelity outputs and verification test suites. | • [`ltx23-samples/`](ltx23-samples/) (20 LTX-Video 2.3 renders)<br>• [`ernie-samples/`](ernie-samples/) (`ernie-samples.zip`)<br>• [`samples/fk9/`](samples/fk9/) (Rose Byrne & Sydney Sweeney outputs)<br>• [`qwen/samples/edit/`](qwen/samples/edit/) (11 Qwen-Image 2.1 character edits) |
23
+ | 🗂️ **[`datasets/`](datasets/)** | **Sample Training Datasets**<br>Small image sets used in the training experiments. | • [`datasets/jinx/`](datasets/jinx/) (19 images)<br>• [`datasets/karengillan/`](datasets/karengillan/) (22 images) |
24
  | 📚 **Guides & Articles** | **Comprehensive Knowledge Base**<br>In-depth technical guides for model training, optimization, and prompt engineering. | • [WAN 2.1 LoRA Training Tutorial](tutorials/wan-21-lora-training.md)<br>• [CivitAI Articles Collection](articles.md) |
25
 
26
  ---
 
38
  - 🎵 **[Audio-Synchronized & C2V Music Videos Guide](h3-center/docs/MINIMAX_AUDIO_SYNC_AND_C2V_MUSIC_VIDEOS.md)**: Techniques for aligning video cadence and singing motion with pre-recorded vocal tracks.
39
  - ⚙️ **[RefMods Installation & Usage Guide](h3-center/docs/MINIMAX_H3_REFMODS_INSTALLATION_AND_USAGE_GUIDE.md)** & **[RefMod Creation Guide](h3-center/docs/MINIMAX_H3_REFMOD_CREATION_GUIDE.md)**: Step-by-step instructions for extracting RefMod `.safetensors` from images and loading them into ComfyUI pipelines.
40
  - ⚖️ **[RefMods vs. Reference Images Comparison](h3-center/docs/MINIMAX_REFMODS_VS_REFERENCE_IMAGES.md)**: Architectural analysis of speed, latent fidelity, and token efficiency comparing pre-computed RefMods against raw pixel reference workflows.
41
+ - 🧪 **[Jinx Identity LoRA Epoch Sweep & RefMod Stack](h3-center/docs/lora/README.md)**: A/B of an identity LoRA (epochs 60 / 80 / final) against a single identity RefMod and both combined, with 6 verified `.mp4` clips. Findings: **RefMod + LoRA is the strongest identity lock**, epoch 60 is already enough, and the LoRA carries the Arcane art style along with the face.
42
+ - 🐍 **RefMod generator script:** [`h3-center/docs/scripts/generate_refmod.py`](h3-center/docs/scripts/generate_refmod.py)
43
 
44
  ### 👥 Known Characters & Usability Database
45
  - 📊 **[Usability Index (INDEX.md)](h3-center/known-characters/INDEX.md)** & **[Unusable Index (INDEX_BAD.md)](h3-center/known-characters/INDEX_BAD.md)**: Empirical test results evaluating over **1,500+** characters, actors, and public figures directly in MiniMax-H3:
 
48
  - **Bad (920+ subjects):** Subjects that fail without custom LoRAs or dedicated RefMods.
49
 
50
  ### 🎥 Crossovers Episodic Cinema Series
51
+ - 🍿 **[Crossovers Series Master Catalog](h3-center/crossovers/README.md)**: 9 narrative episodes created with MiniMax-H3, with cast listings and synopses (8 rendered `.mp4` files in the repo):
52
  - **Episode 1:** *The Contagion of Secrets* (House, Monk, Dwight, Dexter, Malcolm Reynolds, Mulder, Penny)
53
  - **Episode 2:** *The Cosmic Extradition* (Dean Winchester, Mal Reynolds, Sherlock, Pam Beesly, Lucifer, 10th Doctor, Saul Goodman, Steve Rogers, John Locke, Tony Stark)
54
  - **Episode 3:** *Lockdown at Sabre Tower* (Michael Scott, Wednesday Addams, John McClane, Seeley Booth, James Bond, Steve Rogers, Elliot Alderson, Lucifer, Jack Bauer)
 
90
  - Documents failure modes of multi-image referencing for single subjects (token dilution, feature blending).
91
  - Documents failure modes of 2x2 and 3x3 composite grids (grid leak, loss of high-frequency skin textures).
92
  - Provides master production prompt templates for precision face-swapping (preserving body, pose, age, skin pores, and clothing) and multi-character scenes.
93
+ - 🏋️ **[LoRA Optimizer Benchmark: AdamW vs Prodigy vs Automagic3](qwen/docs/QWEN_IMAGE_21_LORA_OPTIMIZER_BENCHMARK.md)**: Two-subject LoRA benchmark (Felicia Day, Rhea Seehorn) trained with **[maltrainer](https://github.com/malcolmamal/maltrainer)** on one RTX 5090 directly from the ComfyUI INT8 checkpoints. Every checkpoint was scored for likeness (ArcFace), prompt adherence (Qwen3-VL judge), seed diversity and memorization.
94
+ - **Recommended: Automagic3, ~1500 steps (60–80 epochs), ≈13–16 minutes.** Likeness plateaus by ~1250 steps and stays flat, with the best prompt adherence and the smallest adapter.
95
+ - Likeness is a tie across optimizers; Prodigy's learning rate keeps climbing until it memorizes the training set and ignores the prompt.
96
+ - Caption finding: if captions say only "a woman …", the trigger never learns gender, so prompt with `"<trigger>, a woman, …"`.
97
+ - Ready-to-use config: [`training-scripts/maltrainer/qwen_image_2_1_template.yaml`](training-scripts/maltrainer/qwen_image_2_1_template.yaml)
98
+
99
+ ### 🖼️ Samples
100
+ - **[`qwen/samples/edit/`](qwen/samples/edit/)**: 11 Qwen-Image 2.1 reference-edit outputs placing actors into iconic roles (e.g. Al Pacino as Tony Montana, Charlize Theron as Furiosa, Mads Mikkelsen as Hannibal Lecter, Gillian Anderson as Dana Scully).
101
 
102
  ---
103
 
 
120
  - 🟢 **[OneTrainer (`training-scripts/onetrainer/`)](training-scripts/onetrainer/)**:
121
  - `fk9_template.json` & `fk9_prodigy_template.json` — Klein 9B / FLUX.2 LoRA templates
122
  - `ernie_template.json` — Ernie training configuration
123
+ - `krea2_template.json` & `krea2prodigy_template.json` — Krea 2 templates
124
+ - `sdxl_template.json` & `sdxl_prodigy_template.json` — SDXL templates
125
+ - `zimage_base_template.json` & `zimage_turbo_template.json` — Z-Image Base / Turbo templates
126
  - 🟣 **[Musubi Tuner (`training-scripts/musubi/`)](training-scripts/musubi/)**:
127
  - `musubi/ernie/` — Multi-resolution Ernie training scripts
128
  - `musubi/ltx23/` — LTX-Video 2.3 video model training configurations
129
  - 🔵 **[AI Toolkit (`training-scripts/aitoolkit/`)](training-scripts/aitoolkit/)**:
130
+ - `fk9_template.yaml` & `fk9r_template.yaml` — Klein 9B / FLUX.2
131
+ - `ideogram4_template.yaml` — Ideogram 4
132
+ - `wan_template.yaml` — WAN 2.1
133
+ - `zimage_template.yaml`, `zbase_template.yaml` & `zonetrainer_template.yaml` — Z-Image variants
134
+ - 🟠 **[MalTrainer (`training-scripts/maltrainer/`)](training-scripts/maltrainer/)** — configs for **[maltrainer](https://github.com/malcolmamal/maltrainer)**, malcolmrey's own trainer:
135
+ - `qwen_image_2_1_template.yaml` — Qwen-Image 2.1 LoRA, the benchmark's recommended setting (Automagic3, ~1500 steps). Trains directly on the ComfyUI INT8 checkpoints. See the [optimizer benchmark](qwen/docs/QWEN_IMAGE_21_LORA_OPTIMIZER_BENCHMARK.md).
136
+ - `zimage_base_template.yaml` — Z-Image Base LoRA
137
 
138
  ---
139
 
 
143
  - 📦 **[`ernie-samples/`](ernie-samples/)**: Comprehensive benchmark sample package (`ernie-samples.zip`).
144
  - 🎬 **[`h3-center/crossovers/`](h3-center/crossovers/)**: 8 rendered `.mp4` full narrative crossover episodes.
145
  - 🎼 **[`h3-center/docs/multistacking/`](h3-center/docs/multistacking/)**: 8 dual-audio and counterpoint singing benchmark videos.
146
+ - 🧪 **[`h3-center/docs/lora/`](h3-center/docs/lora/README.md)**: 6 Jinx identity-LoRA / RefMod comparison clips (5 s, 1344×768).
147
+ - 🎤 **[`h3-center/docs/examples/`](h3-center/docs/examples/)**: 6 Billie Eilish / Miley Cyrus speech, singing and two-shot test clips.
148
+ - 🗜️ **[`ltx-artifacts.zip`](ltx-artifacts.zip)**: 107 MB archive of LTX-Video material.
149
+
150
+ ---
151
+
152
+ ## 🗂️ Sample Datasets (`datasets/`)
153
+
154
+ Small image sets used in the training experiments (images only, no caption files):
155
+
156
+ - **[`datasets/jinx/`](datasets/jinx/)** — 19 images (Jinx / Arcane)
157
+ - **[`datasets/karengillan/`](datasets/karengillan/)** — 22 images (Karen Gillan)
158
 
159
  ---
160
 
h3-center/docs/MINIMAX_H3_HYBRID_LORA_REFMOD_CONTAINERS_GUIDE.md CHANGED
@@ -1,5 +1,7 @@
1
  # Hybrid LoRA + RefMod Container Specification & ComfyUI Implementation Guide
2
 
 
 
3
  _Version: 1.0.0_
4
  _Last Updated: September 2026_
5
  _Target Architecture: MiniMax-H3 (T2V, C2V, R2V), FLUX.2 / Klein9, and ComfyUI Model Pipeline_
 
1
  # Hybrid LoRA + RefMod Container Specification & ComfyUI Implementation Guide
2
 
3
+ > The pack is implemented. How to install it, run a file as a LoRA only or as a LoRA plus its RefMod, and build new files: **[`MINIMAX_H3_REFLORA_GUIDE.md`](MINIMAX_H3_REFLORA_GUIDE.md)**. The node is [ComfyUI-MiniMaxH3RefLoRA](https://github.com/malcolmamal/ComfyUI-MiniMaxH3RefLoRA) (`Load H3 RefLoRA`, `Apply H3 RefLoRA References`, `Pack H3 RefLoRA`). This page is the format notes.
4
+
5
  _Version: 1.0.0_
6
  _Last Updated: September 2026_
7
  _Target Architecture: MiniMax-H3 (T2V, C2V, R2V), FLUX.2 / Klein9, and ComfyUI Model Pipeline_
h3-center/docs/MINIMAX_H3_REFLORA_GUIDE.md ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MiniMax-H3 RefLoRA
2
+
3
+ _Last updated: September 2026_
4
+
5
+ A **RefLoRA** is one `.safetensors` file that holds a MiniMax-H3 LoRA and the RefMod reference latents that belong with it. You can use that file two ways:
6
+
7
+ 1. **As a LoRA only.** Any normal LoRA loader reads the weights and ignores the packed references.
8
+ 2. **As a LoRA plus its RefMod.** The custom node in this guide loads both halves from the same file.
9
+
10
+ The two halves stay in one download, so the reference cannot get separated from the checkpoint it was packed with.
11
+
12
+ Screenshots of the nodes will be added later.
13
+
14
+ ---
15
+
16
+ ## What you need
17
+
18
+ | Piece | What it is |
19
+ | --- | --- |
20
+ | [ComfyUI-MiniMaxH3RefLoRA](https://github.com/malcolmamal/ComfyUI-MiniMaxH3RefLoRA) | The custom node. Load, apply, pack, and inspect. |
21
+ | A RefLoRA `.safetensors` | Drop it anywhere ComfyUI scans for LoRAs, usually `ComfyUI/models/loras/`. |
22
+
23
+ No extra Python packages. ComfyUI already has what the node needs.
24
+
25
+ RefMods on their own still use [ComfyUI-MiniMaxH3Mod](https://github.com/Luisacaotica/ComfyUI-MiniMaxH3Mod). You do not need that pack to *run* a RefLoRA. You do need it if you want to *build* a RefLoRA from a separate LoRA and a separate RefMod, because the Pack node reads RefMods from `models/refmods/`.
26
+
27
+ ---
28
+
29
+ ## Install
30
+
31
+ ```bash
32
+ cd ComfyUI/custom_nodes
33
+ git clone https://github.com/malcolmamal/ComfyUI-MiniMaxH3RefLoRA.git
34
+ ```
35
+
36
+ Restart ComfyUI. The nodes appear under **MiniMax-H3 / reflora**.
37
+
38
+ Comfy Registry name: `comfyui-minimaxh3reflora` (publisher `malcolmrey`).
39
+
40
+ ---
41
+
42
+ ## Use it as a LoRA only
43
+
44
+ Put the file in `models/loras/` and load it with **Load LoRA**, **LoraLoaderModelOnly**, or rgthree **Power Lora Loader**.
45
+
46
+ Those loaders apply the LoRA weights and skip the reference tensors. Identity is whatever the LoRA learned. You do not get the RefMod lock, and you do not spend reference tokens.
47
+
48
+ This is the right choice when you only want the weight patch, or when you are stacking the file in a slot next to Turbo and other LoRAs.
49
+
50
+ ---
51
+
52
+ ## Use it as a LoRA and a RefMod
53
+
54
+ Load **Load H3 RefLoRA (LoRA + RefMod)** instead of a normal LoRA loader.
55
+
56
+ | Input | What to set |
57
+ | --- | --- |
58
+ | `model` | The MiniMax-H3 model, usually after Turbo / attention patches. |
59
+ | `reflora_name` | The RefLoRA file. |
60
+ | `lora_strength` | LoRA weight. `0` skips the weight patch. |
61
+ | `refmod_retention` | Reference strength. `1.0` full lock, `0.7` partial, `0.4` attribute transfer, `0` loads no references (LoRA only, even on this node). |
62
+ | `members` | Which packed references to use: `all`, `none`, `1`, or `1,3-4`. |
63
+ | `attach_to_model` | Off by default. On attaches the references to the model line so you do not wire them into conditioning. Do not turn this on *and* wire `mods` into Apply. That injects every reference twice. |
64
+
65
+ Then wire `mods` into **Apply H3 RefLoRA References**, and that node's conditioning into the sampler. Conditioning comes from `MiniMaxH3ImageToVideo` or `MiniMaxH3ReferenceToVideo`.
66
+
67
+ ```text
68
+ [ model ] ──► [ Load H3 RefLoRA ] ──► model ──► guider
69
+ │
70
+ └── mods ──► [ Apply H3 RefLoRA References ] ◄── conditioning
71
+ │
72
+ └── conditioning ──► guider
73
+ ```
74
+
75
+ `Apply H3 RefMod` from ComfyUI-MiniMaxH3Mod accepts the same `mods` output if you want its curves and presets.
76
+
77
+ `members` = `none` or `refmod_retention` = `0` is the same file used as a LoRA only, through this node.
78
+
79
+ ---
80
+
81
+ ## Make a RefLoRA
82
+
83
+ **Pack H3 RefLoRA** writes a new file into `models/loras/`.
84
+
85
+ | Input | What to set |
86
+ | --- | --- |
87
+ | `lora_name` | The LoRA to pack. |
88
+ | `refmod_1` … `refmod_8` | One or more RefMods from `models/refmods/`. At least one. |
89
+ | `output_name` | File stem. Empty uses the LoRA name plus `_reflora`. |
90
+ | `subfolder` | Folder under `models/loras/`. Default `MinimaxH3/reflora`. |
91
+ | `overwrite` | Off unless you mean to replace a file. |
92
+
93
+ The same job from a terminal, with no torch install:
94
+
95
+ ```bash
96
+ python pack_reflora.py pack --lora minimaxh3_aneta_v1-000060 \
97
+ --refmod minimaxh3_aneta_v1_refmod \
98
+ --out models/loras/MinimaxH3/refloras/minimaxh3_aneta_v1_reflora.safetensors
99
+
100
+ python pack_reflora.py inspect <reflora>
101
+ python pack_reflora.py verify <reflora> --lora <source lora>
102
+ ```
103
+
104
+ Run that script from the custom-node folder. Bare names resolve under `models/loras` and `models/refmods`. Set `COMFYUI_MODELS_DIR` if the script is not inside a ComfyUI install.
105
+
106
+ **Inspect H3 RefLoRA** prints what is in a file: LoRA tensor count, each reference, and token cost. It does not load the weights.
107
+
108
+ ---
109
+
110
+ ## Node pictures
111
+
112
+ To be added:
113
+
114
+ - **Load H3 RefLoRA** and **Apply H3 RefLoRA References** — running a file as LoRA plus RefMod.
115
+ - **Pack H3 RefLoRA** — building a file from a LoRA and one or more RefMods.
116
+
117
+ ---
118
+
119
+ ## Related
120
+
121
+ - [RefMods installation](MINIMAX_H3_REFMODS_INSTALLATION_AND_USAGE_GUIDE.md)
122
+ - [Hybrid container format notes](MINIMAX_H3_HYBRID_LORA_REFMOD_CONTAINERS_GUIDE.md)
123
+ - Node README: [ComfyUI-MiniMaxH3RefLoRA](https://github.com/malcolmamal/ComfyUI-MiniMaxH3RefLoRA)
h3-center/docs/MINIMAX_H3_REFMODS_INSTALLATION_AND_USAGE_GUIDE.md CHANGED
@@ -113,9 +113,12 @@ For multi-character scenes, assign `mod_1` and `mod_2` in the loader and define
113
 
114
  ---
115
 
116
- ## 7. Advanced: Unified Hybrid LoRA + RefMod Containers
117
- To package and distribute both fine-tuned LoRA weights and pre-encoded RefMod latents in a single `.safetensors` file compatible with both standard ComfyUI LoRA loaders and specialized dual loaders, see:
118
- 👉 **[`MINIMAX_H3_HYBRID_LORA_REFMOD_CONTAINERS_GUIDE.md`](MINIMAX_H3_HYBRID_LORA_REFMOD_CONTAINERS_GUIDE.md)**
119
 
120
- Until a hybrid file ships, load identity LoRA and RefMod as two adapters. Empirically, **RefMod + identity LoRA beats either alone**; Jinx epoch 60 is enough (no gain at 80 / final). Clips and write-up:
121
- 👉 **[`lora/README.md`](lora/README.md)**
 
 
 
 
 
 
113
 
114
  ---
115
 
116
+ ## 7. RefLoRA: one file, LoRA or LoRA + RefMod
 
 
117
 
118
+ A **RefLoRA** is that pairing already packed into one `.safetensors`. A normal LoRA loader uses it as a LoRA and ignores the references. **Load H3 RefLoRA** uses both.
119
+
120
+ Install, wiring, and packing: **[`MINIMAX_H3_REFLORA_GUIDE.md`](MINIMAX_H3_REFLORA_GUIDE.md)**.
121
+
122
+ Format notes: **[`MINIMAX_H3_HYBRID_LORA_REFMOD_CONTAINERS_GUIDE.md`](MINIMAX_H3_HYBRID_LORA_REFMOD_CONTAINERS_GUIDE.md)**.
123
+
124
+ Separate LoRA and RefMod files still work. On the Jinx terrace test, RefMod plus the identity LoRA beat either alone, and epoch 60 was enough. Clips: **[`lora/README.md`](lora/README.md)**.
h3-center/docs/lora/README.md CHANGED
@@ -77,7 +77,7 @@ Single-RefMod (not a triple ensemble) is the right comparison here. Jinx does no
77
  | RefMod only | Injects identity latents into conditioning | More live-action, identity looser |
78
  | **Both** | Weights pull style/motion; latents pin the face | **Best likeness, coherent Jinx** |
79
 
80
- This matches the hybrid-container idea: LoRA keys patch MODEL/CLIP; `refmod.*` keys are conditioning. Until a unified file exists, load them as two files in the graph (Power LoRA Loader + RefModsLoader). See [Hybrid LoRA + RefMod Containers](../MINIMAX_H3_HYBRID_LORA_REFMOD_CONTAINERS_GUIDE.md).
81
 
82
  Do **not** read the Picard punch as a likeness test. Combat V2 was on the stack; the hit never connected. Use it only as a mixed-style two-shot example.
83
 
@@ -100,7 +100,7 @@ Until that exists, treat e060 as **identity+style** and the RefMod as **identity
100
  - [RefMod creation](../MINIMAX_H3_REFMOD_CREATION_GUIDE.md)
101
  - [RefMods vs reference images](../MINIMAX_REFMODS_VS_REFERENCE_IMAGES.md)
102
  - [RefMod stacking & multi-subject](../MINIMAX_H3_REFMOD_STACKING_AND_MULTISUBJECT_GUIDE.md)
103
- - [Hybrid LoRA + RefMod containers](../MINIMAX_H3_HYBRID_LORA_REFMOD_CONTAINERS_GUIDE.md)
104
  - [Prompting guide](../MINIMAX_H3_PROMPTING_GUIDE.md)
105
  - [Multi-stacking video suite](../multistacking/README.md)
106
  - Character roll (Arcane prompt, different from this terrace test): [`crossovers/docs/characters/arcane/jinx.md`](../../crossovers/docs/characters/arcane/jinx.md)
 
77
  | RefMod only | Injects identity latents into conditioning | More live-action, identity looser |
78
  | **Both** | Weights pull style/motion; latents pin the face | **Best likeness, coherent Jinx** |
79
 
80
+ This matches the hybrid container: LoRA keys patch MODEL/CLIP; the packed references are conditioning. A RefLoRA file can be loaded as a LoRA only, or as LoRA plus RefMod. See [RefLoRA guide](../MINIMAX_H3_REFLORA_GUIDE.md).
81
 
82
  Do **not** read the Picard punch as a likeness test. Combat V2 was on the stack; the hit never connected. Use it only as a mixed-style two-shot example.
83
 
 
100
  - [RefMod creation](../MINIMAX_H3_REFMOD_CREATION_GUIDE.md)
101
  - [RefMods vs reference images](../MINIMAX_REFMODS_VS_REFERENCE_IMAGES.md)
102
  - [RefMod stacking & multi-subject](../MINIMAX_H3_REFMOD_STACKING_AND_MULTISUBJECT_GUIDE.md)
103
+ - [RefLoRA: one file as a LoRA, or as a LoRA plus its RefMod](../MINIMAX_H3_REFLORA_GUIDE.md)
104
  - [Prompting guide](../MINIMAX_H3_PROMPTING_GUIDE.md)
105
  - [Multi-stacking video suite](../multistacking/README.md)
106
  - Character roll (Arcane prompt, different from this terrace test): [`crossovers/docs/characters/arcane/jinx.md`](../../crossovers/docs/characters/arcane/jinx.md)
h3-center/docs/lora/mieszkania.md DELETED
@@ -1,72 +0,0 @@
1
- Oto **zweryfikowane, aktualne i aktywne** oferty wynajmu mieszkań 3-pokojowych (od 40 m² wzwyż) położonych w wyznaczonym pasie: **od Szczepina (okolice ul. Dobrej / przedszkola) wzdłuż osi Legnickiej / Popowic aż po Dom Handlowy Astra (Gądów Mały / Kwiska / Na Ostatnim Groszu)**.
2
-
3
- ---
4
-
5
- ### 1. Bezpośrednio przy ul. Dobrej (Szczepin)
6
-
7
- * **[Mieszkanie 3-pokojowe – ul. Poznańska (Szczepin)](https://www.olx.pl/d/oferta/mieszkanie-na-wynajem-poznanska-3-pokoje-parter-CID3-ID1c6wfB.html)**
8
- * **Lokalizacja:** ul. Poznańska (tuż obok ul. Dobrej i Pl. Strzegomskiego / „pociągu do nieba”)
9
- * **Metraż:** 48 m²
10
- * **Układ:** 3 pokoje (salon + 2 pokoje), kuchnia, łazienka, parter, piwnica w cenie; po generalnym remoncie, cicha okolica w głębi osiedla.
11
- * **Cena:** 3 500 zł + ok. 1 000 zł (czynsz adm. + prąd wg zużycia)
12
- * **Kaucja:** do uzgodnienia
13
-
14
- * **[Mieszkanie 3-pokojowe – ul. Inowrocławska (Szczepin)](https://www.otodom.pl/pl/oferta/3-pok-szczepin-winda-rozklad-dla-studenta-ID4CDfK)**
15
- * **Lokalizacja:** ul. Inowrocławska (Szczepin, kilka minut pieszo od ul. Dobrej i Pl. Jana Pawła II)
16
- * **Metraż:** 47 m²
17
- * **Układ:** 3 pokoje, kuchnia, łazienka z toaletą, loggia, 1. piętro z windą; w pełni wyposażone (zmywarka, pralko-suszarka, płyta indukcyjna).
18
- * **Cena:** 3 700 zł + 950 zł (czynsz adm. z zaliczkami na media)
19
- * **Kaucja:** 5 000 zł
20
-
21
- ---
22
-
23
- ### 2. Odcinek środkowy: Legnicka / okolice CH Magnolia Park / Popowice
24
-
25
- * **[Nowoczesne 3 pokoje – ul. Legnicka (obok Magnolia Park)](https://www.otodom.pl/pl/oferta/na-wynajem-62-m-3-pokoje-balkon-legnicka-obok-magnolia-park-ID4D5lN)**
26
- * **Lokalizacja:** ul. Legnicka (przy CH Magnolia Park, nowy budynek)
27
- * **Metraż:** 62 m²
28
- * **Układ:** Salon z aneksem kuchennym i wyjściem na balkon + sypialnia główna (łóżko 180 cm) + drugi pokój (gabinet/sypialnia) + łazienka (z pralko-suszarką) + przedpokój z szafą.
29
- * **Cena:** 4 200 zł (do negocjacji) + ok. 1 000 zł opłat; możliwość dokupienia miejsca w garażu podziemnym.
30
-
31
- * **[Rozkładowe 3 pokoje z loggiami – ul. Białowieska 3 (Pixel House / Legnicka)](https://www.otodom.pl/pl/oferta/0prowizji-studenci-pary-rodzina-3-pokoje-rozkladowe-ul-legnicka-ID4rVRs)**
32
- * **Lokalizacja:** ul. Białowieska 3 (budynek Pixel House naprzeciwko Magnolii)
33
- * **Układ:** 3 pokoje (każdy z wyjściem na osobną loggię), wydzielony aneks kuchenny, łazienka z prysznicem i WC; budynek chroniony z windą.
34
- * **Cena:** 4 000 zł (najem z administracją) + 350 zł zaliczki na media. **0% prowizji**.
35
-
36
- * **[3 pokoje po remoncie – ul. Białowieska 15 (Popowice)](https://www.otodom.pl/pl/oferta/3-pokoje-popowice-bialowieska-okolice-magnolii-ID4D8Ko)** *(dostępne też na [OLX](https://www.olx.pl/d/oferta/3-pokoje-popowice-bialowieska-okolice-magnolii-CID3-ID1cebgP.html))*
37
- * **Lokalizacja:** ul. Białowieska 15 (Popowice, okolice Magnolii i parku)
38
- * **Metraż:** 54 m²
39
- * **Układ:** Salon + 2 osobne sypialnie + kuchnia + łazienka + osobne WC + balkon + piwnica. 1. piętro, parking za szlabanem.
40
- * **Cena:** 2 600 zł + ok. 1 100 zł opłat (łącznie ok. 3 700 zł)
41
- * **Kaucja:** 2 600 zł (bez prowizji, od osoby prywatnej)
42
-
43
- * **[3 pokoje z dużym balkonem – ul. Legnicka 118 (przy ul. Kwiskiej)](https://www.olx.pl/d/oferta/3-pokoje-z-duzym-balkonem-legnicka-cisza-parking-za-szlabanem-CID3-ID1ceAKA.html)**
44
- * **Lokalizacja:** ul. Legnicka 118 (druga linia zabudowy, cicho, przy skrzyżowaniu z Kwiską)
45
- * **Metraż:** 54 m²
46
- * **Układ:** 3 pokoje, osobna kuchnia z AGD, łazienka z prysznicem, osobne WC, duży balkon na zieleń, parking za szlabanem dla mieszkańców.
47
- * **Cena:** 2 900 zł + 713 zł opłaty do zarządcy + ok. 300 zł media
48
-
49
- * **[3-pokojowe mieszkanie – ul. Wejherowska (Popowice)](https://www.olx.pl/d/oferta/mieszkanie-3-pokojowe-54m2-do-wynajecia-wejherowska-popowice-dla-2-3-osob-CID3-ID1c2pt7.html)**
50
- * **Lokalizacja:** ul. Wejherowska (blisko Parku Zachodniego i basenu Orbita)
51
- * **Metraż:** 54 m²
52
- * **Układ:** 3 pokoje, balkon, 1. piętro z windą, osobna kuchnia ze zmywarką, osobno łazienka i WC.
53
- * **Cena:** 2 900 zł + 800 zł czynsz adm. + media (prąd ok. 170 zł, internet 70 zł)
54
- * **Kaucja:** 3 000 zł
55
-
56
- ---
57
-
58
- ### 3. Bezpośrednio przy Domu Handlowym Astra (Gądów Mały / Na Ostatnim Groszu)
59
-
60
- * **[3 pokoje – ul. Szybowcowa (tuż przy Astrze)](https://www.otodom.pl/pl/oferta/blisko-tramwaj-balkon-i-piwnica-od-zaraz-okolice-astry-ID4CReY)**
61
- * **Lokalizacja:** ul. Szybowcowa (Gądów Mały, 2 minuty pieszo do CH Astra i przystanków tramwajowych)
62
- * **Metraż:** 50 m²
63
- * **Układ:** 3 pokoje, balkon, piwnica, budynek z windą (wysoki parter), internet w cenie najmu.
64
- * **Cena:** 3 000 zł + ok. 950 zł czynsz adm. + prąd wg zużycia
65
- * **Kaucja:** 4 000 zł
66
-
67
- * **[3 pokoje rozkładowe – ul. Na Ostatnim Groszu (obok Astry)](https://www.otodom.pl/pl/oferta/na-ostatnim-groszu-rozklad-balkon-piwnica-ID4CR68)**
68
- * **Lokalizacja:** ul. Na Ostatnim Groszu (przy Astrze i wylocie na Legnicką)
69
- * **Metraż:** 54 m²
70
- * **Układ:** 3 niezależne pokoje (salon 14,2 m² z balkonem + sypialnie 11,7 m² i 9,7 m²), osobna kuchnia z oknem i zmywarką, łazienka i osobne WC, 9. piętro z windą.
71
- * **Cena:** 3 200 zł + ok. 1 000 zł opłat eksploatacyjnych
72
- * **Kaucja:** 4 200 zł
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
qwen/docs/QWEN_IMAGE_21_LORA_OPTIMIZER_BENCHMARK.md CHANGED
@@ -22,7 +22,7 @@ checkpoint scored for likeness, prompt adherence, diversity and memorization.*
22
  | AdamW 8-bit, lr 1e-4 | 1250–1750 | Solid alternative. Seed diversity slowly erodes after ~1500. |
23
  | Prodigy (d_coef 1.0) | ≤ 1500, if at all | **Not recommended.** Its learning rate keeps climbing, it is erratic mid-run, and by the end it memorizes the training set and ignores the prompt. |
24
 
25
- For datasets of a different size, think in **epochs: ~60–80 epochs** (1500 steps ≈ 65–71 epochs for 21–23 images). With Automagic3, erring long is harmless.
26
 
27
  **Optimal run: Automagic3, ~1500 steps, 512px, rank 16 ≈ 13–16 minutes on a single RTX 5090** (details in [Training time](#training-time-rtx-5090)).
28
 
@@ -220,7 +220,7 @@ Measured from the training logs (512px, batch 1, rank 16):
220
  - **Small samples:** 3 seeds × 3 prompts per checkpoint detects large effects, not small ones. Likeness standard errors are ~0.02–0.04 per optimizer (late checkpoints pooled).
221
  - **ArcFace coverage:** faces were detected in 16/23 Felicia and 19/21 Rhea training photos — enough for a stable reference centroid.
222
  - **The VLM judge is decisive** (probabilities near 0 or 1), so adherence gets its granularity from averaging checks and seeds.
223
- - **512px only.** Qwen-Image 2.1's native resolution is ~1328px. Likeness is already strong at 512; higher resolution is the next lever for fine detail and was not tested here.
224
  - **Two subjects, both women, both close-up portrait datasets.** The conclusions on optimizer *behaviour* (Prodigy's LR growth, Automagic3's decay) held on both, but they have not been checked on other kinds of subjects or on styles.
225
 
226
  ---
@@ -236,7 +236,8 @@ lora:
236
 
237
  train:
238
  batch_size: 1
239
- num_epochs: 70 # ~1500 steps for ~21 images; aim for 60-80 epochs
 
240
  save_every: 250
241
  optimizer: "automagic3"
242
  learning_rate: 1.0e-6 # launch point only - Automagic3 adapts it
 
22
  | AdamW 8-bit, lr 1e-4 | 1250–1750 | Solid alternative. Seed diversity slowly erodes after ~1500. |
23
  | Prodigy (d_coef 1.0) | ≤ 1500, if at all | **Not recommended.** Its learning rate keeps climbing, it is erratic mid-run, and by the end it memorizes the training set and ignores the prompt. |
24
 
25
+ For datasets of a different size, think in **epochs: ~60–80 epochs** (1500 steps ≈ 65–71 epochs for 21–23 images). With Automagic3, erring long is harmless. (maltrainer's web UI applies this automatically, within 1000–2500 steps. Both benchmark datasets had 21–23 images, so other sizes are an extrapolation.)
26
 
27
  **Optimal run: Automagic3, ~1500 steps, 512px, rank 16 ≈ 13–16 minutes on a single RTX 5090** (details in [Training time](#training-time-rtx-5090)).
28
 
 
220
  - **Small samples:** 3 seeds × 3 prompts per checkpoint detects large effects, not small ones. Likeness standard errors are ~0.02–0.04 per optimizer (late checkpoints pooled).
221
  - **ArcFace coverage:** faces were detected in 16/23 Felicia and 19/21 Rhea training photos — enough for a stable reference centroid.
222
  - **The VLM judge is decisive** (probabilities near 0 or 1), so adherence gets its granularity from averaging checks and seeds.
223
+ - **Square 512×512 only.** maltrainer currently trains at square 512×512, and more resolutions plus an aspect-ratio bucketing system are planned. Qwen-Image 2.1's native resolution is ~1328px. Likeness is already strong at 512; higher resolution is the next lever for fine detail and was not tested here. Both datasets were already square, so squashing non-square images was never a factor.
224
  - **Two subjects, both women, both close-up portrait datasets.** The conclusions on optimizer *behaviour* (Prodigy's LR growth, Automagic3's decay) held on both, but they have not been checked on other kinds of subjects or on styles.
225
 
226
  ---
 
236
 
237
  train:
238
  batch_size: 1
239
+ max_steps: 1500 # stops exactly here; set 0 to train num_epochs instead
240
+ num_epochs: 70 # used when max_steps is 0; aim for 60-80 epochs
241
  save_every: 250
242
  optimizer: "automagic3"
243
  learning_rate: 1.0e-6 # launch point only - Automagic3 adapts it
training-scripts/maltrainer/qwen_image_2_1_template.yaml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Qwen-Image 2.1 LoRA Training Configuration - maltrainer (https://github.com/malcolmamal/maltrainer)
2
+ #
3
+ # The recommended setting from the Qwen-Image 2.1 optimizer benchmark:
4
+ # qwen/docs/QWEN_IMAGE_21_LORA_OPTIMIZER_BENCHMARK.md
5
+ # Automagic3, ~1500 steps, 512px, rank 16 -> about 13-16 minutes on one RTX 5090 (~11 GB VRAM).
6
+ #
7
+ # Run with: python train_qwen_image_2_1_lora.py --config qwen_image_2_1_template.yaml
8
+ # Sanity-check the stack first: python scripts/qwen_2_1_stack_probe.py --config qwen_image_2_1_template.yaml
9
+
10
+ # Model configuration - the ComfyUI single-file checkpoints from Comfy-Org/Qwen-Image-2.1, no diffusers conversion
11
+ model:
12
+ transformer_path: "[comfyui_location]/models/diffusion_models/qwen_image_2.1_int8_convrot.safetensors"
13
+ vae_path: "[comfyui_location]/models/vae/qwen_image_2.1_vae_bf16.safetensors"
14
+ text_encoder_path: "[comfyui_location]/models/text_encoders/qwen3vl_8b_int8_convrot.safetensors"
15
+
16
+ # Dataset configuration
17
+ # Caption files (.txt next to each image) are recommended. Write them as "[instance_token], a [class_token] with ..."
18
+ # so the trigger binds to the class word. If captions only say "a woman ..." the trigger never learns gender,
19
+ # and prompts without the class word (e.g. "[instance_token] as a medieval knight") can come out as a man.
20
+ dataset:
21
+ path: "[dataset_location]/[person_to_train]"
22
+ resolution: 512 # square 512x512 only for now (no cropping or bucketing yet: crop your images to
23
+ # square first). More resolutions and aspect-ratio bucketing are planned.
24
+ trigger: "[instance_token]"
25
+ default_caption: "a photo of [instance_token], a [class_token]"
26
+ repeats: 1
27
+ num_workers: 0
28
+
29
+ # LoRA configuration - all 32 blocks, attention + MLP (192 layers, 39.8M params at rank 16)
30
+ lora:
31
+ rank: 16
32
+ alpha: 16
33
+ prefix: "diffusion_model."
34
+ target_modules:
35
+ - "to_q"
36
+ - "to_k"
37
+ - "to_v"
38
+ - "to_out.0"
39
+ - "gate_up"
40
+ - "img_mlp.out"
41
+ dtype: "float32"
42
+
43
+ # Training configuration
44
+ train:
45
+ batch_size: 1
46
+ gradient_accumulation_steps: 1
47
+ max_steps: 1500 # stops exactly here. Set 0 to train num_epochs instead.
48
+ num_epochs: 70 # used when max_steps is 0. Aim for 60-80 epochs; Automagic3 tolerates running long.
49
+ save_every: 250
50
+ timestep_distribution: "shift"
51
+ sigmoid_scale: 1.0
52
+ max_grad_norm: 1.0
53
+ optimizer: "automagic3"
54
+ learning_rate: 1.0e-6 # launch point only - Automagic3 adapts it (peaks ~2e-4, then decays to ~1e-5)
55
+ weight_decay: 0.01
56
+ automagic_polarity_history: 8
57
+ automagic_clip_threshold: 1.0
58
+ automagic_beta2: 0.999
59
+ automagic_eps: 1.0e-30
60
+ # Alternative: optimizer "adamw8bit" with learning_rate 1.0e-4, keep checkpoints 1250-1750.
61
+ # Prodigy is not recommended on this model: its LR keeps climbing and it overcooks.
62
+
63
+ dtype: "bfloat16"
64
+ mixed_precision: "bf16"
65
+ seed: 42
66
+
67
+ output:
68
+ path: "[output_location]/[person_to_train]"
69
+ name: "qwen21_[person_to_train]"
70
+ format: "diffusers" # lora_A / lora_B keys with the diffusion_model. prefix - loads in ComfyUI
71
+ dtype: "bfloat16"
72
+ embed_config: true
73
+
74
+ logging:
75
+ level: "INFO"