File size: 1,959 Bytes
b9776c8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
license: mit
library_name: diffusers
pipeline_tag: text-to-image
tags:
- diffusers
- imf
- image-generation
- class-conditional
- imagenet
inference: true
widget:
- output:
    url: iMF-XL-2/demo.png
language:
- en
---

# iMF-diffusers

Native diffusers implementation of [Improved Mean Flows (iMF)](https://arxiv.org/abs/2512.02012). Each variant folder is self-contained:

- `pipeline.py``IMFPipeline`
- `scheduler/scheduler_config.json``FlowMatchEulerDiscreteScheduler` config
- `transformer/transformer_imf.py``IMFTransformer2DModel`
- `vae/` — bundled `stabilityai/sd-vae-ft-mse` (`AutoencoderKL`)

## Demo

![iMF-XL-2 demo](iMF-XL-2/demo.png)

Class-conditional sample (ImageNet class **207**, golden retriever), `iMF-XL/2` at 256×256, 1 step, CFG 1.8, interval [0.0, 1.0], seed 42.

## Available checkpoints

| Checkpoint | Path | Latent size | FID eval CFG (ω) | FID eval interval |
| --- | --- | --- | --- | --- |
| iMF-B/2 | `./iMF-B-2` | 32×32 | 8.0 | [0.40, 0.65] |
| iMF-L/2 | `./iMF-L-2` | 32×32 | 10.5 | [0.40, 0.60] |
| iMF-XL/2 | `./iMF-XL-2` | 32×32 | 8.0 | [0.42, 0.62] |

FID eval settings follow upstream [imeanflow eval config](https://github.com/Lyy-iiis/imeanflow/blob/main/configs/eval_config.yml).

## Inference

```python
from pathlib import Path
from diffusers import DiffusionPipeline
import torch

model_dir = Path("./iMF-XL-2")
pipe = DiffusionPipeline.from_pretrained(
    str(model_dir),
    local_files_only=True,
    custom_pipeline=str(model_dir / "pipeline.py"),
    trust_remote_code=True,
    torch_dtype=torch.bfloat16,
).to("cuda")

generator = torch.Generator(device="cuda").manual_seed(42)
image = pipe(
    class_labels="golden retriever",
    num_inference_steps=1,
    guidance_scale=1.8,
    guidance_interval_start=0.0,
    guidance_interval_end=1.0,
    generator=generator,
).images[0]
image.save("demo.png")
```

Load a **variant subfolder** (e.g. `./iMF-XL-2`), not the repo root.