Instructions to use Jialuo21/Imago-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Jialuo21/Imago-4B with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("Jialuo21/Imago-4B", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
Upload final full-parameter Imago-4B transformer weights
Browse files- README.md +51 -199
- adapter_config.json +0 -55
- config.json +24 -0
- adapter_model.safetensors → diffusion_pytorch_model.safetensors +2 -2
README.md
CHANGED
|
@@ -1,204 +1,56 @@
|
|
| 1 |
---
|
| 2 |
base_model: black-forest-labs/FLUX.2-klein-base-4B
|
| 3 |
-
library_name:
|
|
|
|
| 4 |
tags:
|
| 5 |
-
-
|
|
|
|
|
|
|
|
|
|
| 6 |
---
|
| 7 |
|
| 8 |
-
#
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
- **
|
| 23 |
-
- **
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
### Out-of-Scope Use
|
| 55 |
-
|
| 56 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
| 57 |
-
|
| 58 |
-
[More Information Needed]
|
| 59 |
-
|
| 60 |
-
## Bias, Risks, and Limitations
|
| 61 |
-
|
| 62 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 63 |
-
|
| 64 |
-
[More Information Needed]
|
| 65 |
-
|
| 66 |
-
### Recommendations
|
| 67 |
-
|
| 68 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 69 |
-
|
| 70 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 71 |
-
|
| 72 |
-
## How to Get Started with the Model
|
| 73 |
-
|
| 74 |
-
Use the code below to get started with the model.
|
| 75 |
-
|
| 76 |
-
[More Information Needed]
|
| 77 |
-
|
| 78 |
-
## Training Details
|
| 79 |
-
|
| 80 |
-
### Training Data
|
| 81 |
-
|
| 82 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
| 83 |
-
|
| 84 |
-
[More Information Needed]
|
| 85 |
-
|
| 86 |
-
### Training Procedure
|
| 87 |
-
|
| 88 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 89 |
-
|
| 90 |
-
#### Preprocessing [optional]
|
| 91 |
-
|
| 92 |
-
[More Information Needed]
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
#### Training Hyperparameters
|
| 96 |
-
|
| 97 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 98 |
-
|
| 99 |
-
#### Speeds, Sizes, Times [optional]
|
| 100 |
-
|
| 101 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 102 |
-
|
| 103 |
-
[More Information Needed]
|
| 104 |
-
|
| 105 |
-
## Evaluation
|
| 106 |
-
|
| 107 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 108 |
-
|
| 109 |
-
### Testing Data, Factors & Metrics
|
| 110 |
-
|
| 111 |
-
#### Testing Data
|
| 112 |
-
|
| 113 |
-
<!-- This should link to a Dataset Card if possible. -->
|
| 114 |
-
|
| 115 |
-
[More Information Needed]
|
| 116 |
-
|
| 117 |
-
#### Factors
|
| 118 |
-
|
| 119 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 120 |
-
|
| 121 |
-
[More Information Needed]
|
| 122 |
-
|
| 123 |
-
#### Metrics
|
| 124 |
-
|
| 125 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 126 |
-
|
| 127 |
-
[More Information Needed]
|
| 128 |
-
|
| 129 |
-
### Results
|
| 130 |
-
|
| 131 |
-
[More Information Needed]
|
| 132 |
-
|
| 133 |
-
#### Summary
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
## Model Examination [optional]
|
| 138 |
-
|
| 139 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 140 |
-
|
| 141 |
-
[More Information Needed]
|
| 142 |
-
|
| 143 |
-
## Environmental Impact
|
| 144 |
-
|
| 145 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 146 |
-
|
| 147 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 148 |
-
|
| 149 |
-
- **Hardware Type:** [More Information Needed]
|
| 150 |
-
- **Hours used:** [More Information Needed]
|
| 151 |
-
- **Cloud Provider:** [More Information Needed]
|
| 152 |
-
- **Compute Region:** [More Information Needed]
|
| 153 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 154 |
-
|
| 155 |
-
## Technical Specifications [optional]
|
| 156 |
-
|
| 157 |
-
### Model Architecture and Objective
|
| 158 |
-
|
| 159 |
-
[More Information Needed]
|
| 160 |
-
|
| 161 |
-
### Compute Infrastructure
|
| 162 |
-
|
| 163 |
-
[More Information Needed]
|
| 164 |
-
|
| 165 |
-
#### Hardware
|
| 166 |
-
|
| 167 |
-
[More Information Needed]
|
| 168 |
-
|
| 169 |
-
#### Software
|
| 170 |
-
|
| 171 |
-
[More Information Needed]
|
| 172 |
-
|
| 173 |
-
## Citation [optional]
|
| 174 |
-
|
| 175 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 176 |
-
|
| 177 |
-
**BibTeX:**
|
| 178 |
-
|
| 179 |
-
[More Information Needed]
|
| 180 |
-
|
| 181 |
-
**APA:**
|
| 182 |
-
|
| 183 |
-
[More Information Needed]
|
| 184 |
-
|
| 185 |
-
## Glossary [optional]
|
| 186 |
-
|
| 187 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 188 |
-
|
| 189 |
-
[More Information Needed]
|
| 190 |
-
|
| 191 |
-
## More Information [optional]
|
| 192 |
-
|
| 193 |
-
[More Information Needed]
|
| 194 |
-
|
| 195 |
-
## Model Card Authors [optional]
|
| 196 |
-
|
| 197 |
-
[More Information Needed]
|
| 198 |
-
|
| 199 |
-
## Model Card Contact
|
| 200 |
-
|
| 201 |
-
[More Information Needed]
|
| 202 |
-
### Framework versions
|
| 203 |
-
|
| 204 |
-
- PEFT 0.18.1
|
|
|
|
| 1 |
---
|
| 2 |
base_model: black-forest-labs/FLUX.2-klein-base-4B
|
| 3 |
+
library_name: diffusers
|
| 4 |
+
pipeline_tag: text-to-image
|
| 5 |
tags:
|
| 6 |
+
- text-to-image
|
| 7 |
+
- diffusers
|
| 8 |
+
- reinforcement-learning
|
| 9 |
+
- imago
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Imago-4B
|
| 13 |
+
|
| 14 |
+
**Imago-4B** is a full-parameter RL post-trained DiT transformer from *Imago: Maturing Visual Generation with RL*, initialized from [`black-forest-labs/FLUX.2-klein-base-4B`](https://huggingface.co/black-forest-labs/FLUX.2-klein-base-4B).
|
| 15 |
+
|
| 16 |
+
## Benchmark Results (Kimi-K2.6 Judge)
|
| 17 |
+
|
| 18 |
+
| Model | Mean | T2I-CompBench | TIIF-Bench | SpatialGenEval | T2I-CoReBench | LPD-Bench | Arena-T2I-Hard | LongBench-T2I | DrawBench PickScore |
|
| 19 |
+
|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
|
| 20 |
+
| Imago-4B | **82.7** | 4.09 | 84.7 | 80.9 | 88.7 | 93.0 | 80.0 | 3.50 | 22.8 |
|
| 21 |
+
| FLUX.2-Klein-Base (4B) | 73.8 | 3.84 | 77.1 | 71.6 | 77.2 | 88.8 | 67.7 | 2.88 | 22.4 |
|
| 22 |
+
|
| 23 |
+
## Training Recipe
|
| 24 |
+
- **Reward**: Zero-shot Qwen3.5-9B ProbScore
|
| 25 |
+
- **Curriculum**: Two-stage sequential RL (`Jialuo21/Imago-Short` -> `Jialuo21/Imago-Long`)
|
| 26 |
+
- **Algorithm**: DiffusionNFT with Branch Sampling, DAVE, and scalar velocity norm regularization (no CFG, no KL penalty)
|
| 27 |
+
- **Settings**: LR `1e-6`, 500 steps on `Imago-Short` -> 500 steps on `Imago-Long`, Branch Sampling (`t in [0.8, 1.0]`), DAVE (`block 14/25`), Norm Reg. (`beta=0.07`)
|
| 28 |
+
|
| 29 |
+
## Usage
|
| 30 |
+
|
| 31 |
+
This repository contains the fine-tuned DiT transformer weights (`config.json` + `diffusion_pytorch_model.safetensors`). Load it into the base `Flux2KleinPipeline`:
|
| 32 |
+
|
| 33 |
+
```python
|
| 34 |
+
import torch
|
| 35 |
+
from diffusers import Flux2KleinPipeline, Flux2Transformer2DModel
|
| 36 |
+
|
| 37 |
+
transformer = Flux2Transformer2DModel.from_pretrained(
|
| 38 |
+
"Jialuo21/Imago-4B",
|
| 39 |
+
torch_dtype=torch.bfloat16,
|
| 40 |
+
)
|
| 41 |
+
pipe = Flux2KleinPipeline.from_pretrained(
|
| 42 |
+
"black-forest-labs/FLUX.2-klein-base-4B",
|
| 43 |
+
transformer=transformer,
|
| 44 |
+
torch_dtype=torch.bfloat16,
|
| 45 |
+
).to("cuda")
|
| 46 |
+
|
| 47 |
+
image = pipe(
|
| 48 |
+
prompt="A weathered brass telescope resting on a wooden tripod next to an open leather-bound star atlas on a stone balcony overlooking a moonlit harbor.",
|
| 49 |
+
height=1024,
|
| 50 |
+
width=1024,
|
| 51 |
+
num_inference_steps=50,
|
| 52 |
+
guidance_scale=4.0,
|
| 53 |
+
generator=torch.Generator("cuda").manual_seed(0),
|
| 54 |
+
).images[0]
|
| 55 |
+
image.save("imago-4b.png")
|
| 56 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
adapter_config.json
DELETED
|
@@ -1,55 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"alora_invocation_tokens": null,
|
| 3 |
-
"alpha_pattern": {},
|
| 4 |
-
"arrow_config": null,
|
| 5 |
-
"auto_mapping": {
|
| 6 |
-
"base_model_class": "Flux2Transformer2DModel",
|
| 7 |
-
"parent_library": "diffusers.models.transformers.transformer_flux2"
|
| 8 |
-
},
|
| 9 |
-
"base_model_name_or_path": null,
|
| 10 |
-
"bias": "none",
|
| 11 |
-
"corda_config": null,
|
| 12 |
-
"ensure_weight_tying": false,
|
| 13 |
-
"eva_config": null,
|
| 14 |
-
"exclude_modules": null,
|
| 15 |
-
"fan_in_fan_out": false,
|
| 16 |
-
"inference_mode": true,
|
| 17 |
-
"init_lora_weights": "gaussian",
|
| 18 |
-
"layer_replication": null,
|
| 19 |
-
"layers_pattern": null,
|
| 20 |
-
"layers_to_transform": null,
|
| 21 |
-
"loftq_config": {},
|
| 22 |
-
"lora_alpha": 512,
|
| 23 |
-
"lora_bias": false,
|
| 24 |
-
"lora_dropout": 0.0,
|
| 25 |
-
"megatron_config": null,
|
| 26 |
-
"megatron_core": "megatron.core",
|
| 27 |
-
"modules_to_save": null,
|
| 28 |
-
"peft_type": "LORA",
|
| 29 |
-
"peft_version": "0.18.1",
|
| 30 |
-
"qalora_group_size": 16,
|
| 31 |
-
"r": 256,
|
| 32 |
-
"rank_pattern": {},
|
| 33 |
-
"revision": null,
|
| 34 |
-
"target_modules": [
|
| 35 |
-
"ff_context.linear_out",
|
| 36 |
-
"attn.add_k_proj",
|
| 37 |
-
"attn.add_v_proj",
|
| 38 |
-
"ff.linear_in",
|
| 39 |
-
"attn.to_add_out",
|
| 40 |
-
"attn.to_q",
|
| 41 |
-
"attn.to_k",
|
| 42 |
-
"attn.to_v",
|
| 43 |
-
"ff.linear_out",
|
| 44 |
-
"ff_context.linear_in",
|
| 45 |
-
"attn.to_qkv_mlp_proj",
|
| 46 |
-
"attn.add_q_proj",
|
| 47 |
-
"attn.to_out.0"
|
| 48 |
-
],
|
| 49 |
-
"target_parameters": null,
|
| 50 |
-
"task_type": null,
|
| 51 |
-
"trainable_token_indices": null,
|
| 52 |
-
"use_dora": false,
|
| 53 |
-
"use_qalora": false,
|
| 54 |
-
"use_rslora": false
|
| 55 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_class_name": "Flux2Transformer2DModel",
|
| 3 |
+
"_diffusers_version": "0.37.0.dev0",
|
| 4 |
+
"_name_or_path": "saves/imago-4b-full-v3-stage2-long-s42/checkpoints/checkpoint-450",
|
| 5 |
+
"attention_head_dim": 128,
|
| 6 |
+
"axes_dims_rope": [
|
| 7 |
+
32,
|
| 8 |
+
32,
|
| 9 |
+
32,
|
| 10 |
+
32
|
| 11 |
+
],
|
| 12 |
+
"eps": 1e-06,
|
| 13 |
+
"guidance_embeds": false,
|
| 14 |
+
"in_channels": 128,
|
| 15 |
+
"joint_attention_dim": 7680,
|
| 16 |
+
"mlp_ratio": 3.0,
|
| 17 |
+
"num_attention_heads": 24,
|
| 18 |
+
"num_layers": 5,
|
| 19 |
+
"num_single_layers": 20,
|
| 20 |
+
"out_channels": null,
|
| 21 |
+
"patch_size": 1,
|
| 22 |
+
"rope_theta": 2000,
|
| 23 |
+
"timestep_guidance_channels": 256
|
| 24 |
+
}
|
adapter_model.safetensors → diffusion_pytorch_model.safetensors
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9ca73574055286a658217a327b83c9f9aaeabb38c2d4a38f640c1e5720e213d1
|
| 3 |
+
size 15502198920
|