Text-to-Image
Diffusers
Safetensors
English
fd-loss
jit
imf
pmf
image-generation
class-conditional
imagenet
Instructions to use BiliSakura/FD-Loss-diffusers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use BiliSakura/FD-Loss-diffusers with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("BiliSakura/FD-Loss-diffusers", 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
File size: 7,001 Bytes
6786303 | 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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | ---
license: mit
library_name: diffusers
pipeline_tag: text-to-image
tags:
- diffusers
- fd-loss
- jit
- imf
- pmf
- image-generation
- class-conditional
- imagenet
inference: true
widget:
- output:
url: JiT-H-16-SIM/demo.png
language:
- en
---
# FD-Loss-diffusers
Post-training checkpoints with the same JiT / iMF / pMF architectures as the base models, distilled with FD-loss (feature distillation).
- **JiT**: all `/16` variants for 256px generation
- **iMF**: all variants for 256px generation
- **pMF**: both `/16` and `/32`
- **SIM** suffix: SigLIP + Inception + MAE FD-loss
- Default inference: **1 NFE** (`num_inference_steps=1`)
FD-Loss JiT uses **legacy time convention** and **velocity Euler** via bundled `FDLossFlowMatchScheduler` (`scheduler/scheduling_flow_match_fd.py`; timesteps `t=1→0`).
## Demo

Class-conditional sample (ImageNet class **golden retriever**), `JiT-H/16` FD-SIM at 256×256, 1 NFE, CFG 2.2, interval [0.1, 1.0], seed 42.
## Inference (`JiT-B-16-SIM`)
```python
from pathlib import Path
import torch
from diffusers import DiffusionPipeline
model_dir = Path("./JiT-B-16-SIM")
pipe = DiffusionPipeline.from_pretrained(
str(model_dir),
custom_pipeline=str(model_dir / "pipeline.py"),
trust_remote_code=True,
)
pipe.to("cuda")
generator = torch.Generator(device="cuda").manual_seed(42)
image = pipe(
class_labels="golden retriever",
num_inference_steps=1, # 1 NFE (FD-Loss default)
guidance_scale=3.0,
guidance_interval_min=0.1,
guidance_interval_max=1.0,
generator=generator,
).images[0]
```
| Parameter | JiT-B-16-SIM default | Source |
| --- | --- | --- |
| `num_inference_steps` | `1` | `--num_sampling_steps 1` |
| `guidance_scale` | `3.0` | JiT_B eval preset |
| `guidance_interval_min` / `max` | `0.1` / `1.0` | JiT_B eval preset |
| `legacy_time_convention` | `True` (pipeline default) | `--legacy_time_convention` |
## Inference (`JiT-L-16-SIM`)
Same loading pattern as JiT-B; use **CFG 2.4** (JiT_L eval preset):
```python
model_dir = Path("./JiT-L-16-SIM")
pipe = DiffusionPipeline.from_pretrained(
str(model_dir),
custom_pipeline=str(model_dir / "pipeline.py"),
trust_remote_code=True,
).to("cuda")
image = pipe(
class_labels="golden retriever",
num_inference_steps=1,
guidance_scale=2.4,
generator=torch.Generator(device="cuda").manual_seed(42),
).images[0]
```
## Inference (`JiT-H-16-SIM`)
Same loading pattern as JiT-B/L; use **CFG 2.2** (JiT_H eval preset):
```python
model_dir = Path("./JiT-H-16-SIM")
pipe = DiffusionPipeline.from_pretrained(
str(model_dir),
custom_pipeline=str(model_dir / "pipeline.py"),
trust_remote_code=True,
).to("cuda")
image = pipe(
class_labels="golden retriever",
num_inference_steps=1,
guidance_scale=2.2,
guidance_interval_min=0.1,
guidance_interval_max=1.0,
generator=torch.Generator(device="cuda").manual_seed(42),
).images[0]
```
## Available variants
| Variant | Path | Architecture | Resolution | CFG (1 NFE) |
| --- | --- | --- | --- | --- |
| JiT-B-16-SIM | `./JiT-B-16-SIM` | JiT-B/16 | 256×256 | 3.0 |
| JiT-L-16-SIM | `./JiT-L-16-SIM` | JiT-L/16 | 256×256 | 2.4 |
| JiT-H-16-SIM | `./JiT-H-16-SIM` | JiT-H/16 | 256×256 | 2.2 |
| iMF-B-SIM | `./iMF-B-SIM` | iMF-B/2 | 256×256 | 8.0 |
| iMF-L-SIM | `./iMF-L-SIM` | iMF-L/2 | 256×256 | 8.0 |
| iMF-XL-SIM | `./iMF-XL-SIM` | iMF-XL/2 | 256×256 | 8.0 |
| pMF-B-16-SIM | `./pMF-B-16-SIM` | pMF-B/16 | 256×256 | 7.5 |
| pMF-B-32-SIM | `./pMF-B-32-SIM` | pMF-B/32 | 512×512 | 6.5 |
| pMF-L-16-SIM | `./pMF-L-16-SIM` | pMF-L/16 | 256×256 | 7.0 |
| pMF-L-32-SIM | `./pMF-L-32-SIM` | pMF-L/32 | 512×512 | 7.5 |
| pMF-H-32-SIM | `./pMF-H-32-SIM` | pMF-H/32 | 512×512 | 5.5 |
## Inference (`iMF-B-SIM`)
Uses production `IMFPipeline` from `iMF-diffusers/iMF-B-2` (native iMF time convention, not legacy JiT time). Use **`torch.float32`** (same as base iMF variants):
```python
model_dir = Path("./iMF-B-SIM")
pipe = DiffusionPipeline.from_pretrained(
str(model_dir),
custom_pipeline=str(model_dir / "pipeline.py"),
trust_remote_code=True,
torch_dtype=torch.float32,
).to("cuda")
image = pipe(
class_labels="golden retriever",
num_inference_steps=1,
guidance_scale=8.0,
guidance_interval_start=0.4,
guidance_interval_end=0.65,
generator=torch.Generator(device="cuda").manual_seed(42),
).images[0]
```
## Inference (`iMF-L-SIM`)
Same loading pattern as iMF-B-SIM (production `IMFPipeline` from `iMF-diffusers/iMF-L-2`):
```python
model_dir = Path("./iMF-L-SIM")
pipe = DiffusionPipeline.from_pretrained(
str(model_dir),
custom_pipeline=str(model_dir / "pipeline.py"),
trust_remote_code=True,
torch_dtype=torch.float32,
).to("cuda")
image = pipe(
class_labels="golden retriever",
num_inference_steps=1,
guidance_scale=8.0,
guidance_interval_start=0.4,
guidance_interval_end=0.65,
generator=torch.Generator(device="cuda").manual_seed(42),
).images[0]
```
Regenerate from checkpoint:
```bash
python _convert_imf_l_fd_sim.py
```
## Inference (`iMF-XL-SIM`)
Same loading pattern as iMF-B/L-SIM (production `IMFPipeline` from `iMF-diffusers/iMF-XL-2`):
```python
model_dir = Path("./iMF-XL-SIM")
pipe = DiffusionPipeline.from_pretrained(
str(model_dir),
custom_pipeline=str(model_dir / "pipeline.py"),
trust_remote_code=True,
torch_dtype=torch.float32,
).to("cuda")
image = pipe(
class_labels="golden retriever",
num_inference_steps=1,
guidance_scale=8.0,
guidance_interval_start=0.4,
guidance_interval_end=0.65,
generator=torch.Generator(device="cuda").manual_seed(42),
).images[0]
```
## Inference (`pMF-B-16-SIM`)
Uses production `PMFPipeline` from `pMF-diffusers/pMF-B-16` (native pMF time convention). Use **`torch.bfloat16`** on CUDA:
```python
model_dir = Path("./pMF-B-16-SIM")
pipe = DiffusionPipeline.from_pretrained(
str(model_dir),
custom_pipeline=str(model_dir / "pipeline.py"),
trust_remote_code=True,
torch_dtype=torch.bfloat16,
).to("cuda")
image = pipe(
class_labels="golden retriever",
num_inference_steps=1,
guidance_scale=7.5,
guidance_interval_min=0.1,
guidance_interval_max=0.8,
noise_scale=1.0,
generator=torch.Generator(device="cuda").manual_seed(42),
).images[0]
```
## Inference (`pMF-B-32-SIM`)
Same loading pattern as pMF-B-16-SIM (production `PMFPipeline` from `pMF-diffusers/pMF-B-32`):
```python
model_dir = Path("./pMF-B-32-SIM")
pipe = DiffusionPipeline.from_pretrained(
str(model_dir),
custom_pipeline=str(model_dir / "pipeline.py"),
trust_remote_code=True,
torch_dtype=torch.bfloat16,
).to("cuda")
image = pipe(
class_labels="golden retriever",
num_inference_steps=1,
guidance_scale=6.5,
guidance_interval_min=0.1,
guidance_interval_max=0.7,
noise_scale=2.0,
generator=torch.Generator(device="cuda").manual_seed(42),
).images[0]
```
|