Skip to content
fn

rectified_flow_cifar

→RectifiedFlowModel
rectified_flow_cifar(pretrained: bool = False, overrides: object = {})

Rectified Flow velocity field for the CIFAR-10 setup.

The configuration the paper's headline result was produced with. Trained by regressing onto the constant velocity of the straight line between a noise sample and a data sample; reflow and distillation are the same call with paired inputs and a pinned time.

Model Size

Parameters

pretrainedbool= False
No checkpoint is published for rectified_flow_cifar, so True raises NotImplementedError rather than return randomly initialised weights.
**overridesobject= {}
Optional RectifiedFlowConfig field overrides forwarded into the underlying config.

Returns

RectifiedFlowModel

Velocity field configured for 32 x 32 RGB.

Notes

Reference: Liu, Gong, and Liu, "Flow Straight and Fast", ICLR, 2023 (arXiv:2209.03003). Reported on CIFAR-10: 4.85 FID with a single function evaluation, state of the art among one-step diffusion and flow models at publication.

Examples

>>> import lucid
>>> from lucid.models.generative.rectified_flow import rectified_flow_cifar
>>> model = rectified_flow_cifar(sample_size=8, base_channels=16,
...                              channel_mult=(1, 2), num_res_blocks=1,
...                              attention_resolutions=()).eval()
>>> loss, _, _ = model.rectified_flow_loss(lucid.randn((2, 3, 8, 8)))
>>> model.nfe                      # training solves nothing
0

Used by 1