Skip to content
data

FlowMatchingConfig

extendsGenerativeModelConfig
FlowMatchingConfig(sample_size: int | tuple[int, int] = 32, in_channels: int = 3, out_channels: int = 3, act_fn: GenerativeActivation = 'silu', base_channels: int = 128, channel_mult: tuple[int, ...] = (lambda: (1, 2, 2, 2))(), num_res_blocks: int = 2, attention_resolutions: tuple[int, ...] = (lambda: (32, 16, 8))(), num_head_channels: int = 64, dropout: float = 0.0, resnet_groups: int = 32, path: ProbabilityPath = 'ot', sigma_min: float = 0.0001, beta_min: float = 0.1, beta_max: float = 20.0, solver: str = 'dopri5', rtol: float = 1e-05, atol: float = 1e-05, trace_method: TraceMethod | None = None, trace_noise: TraceNoise = 'rademacher', exact_trace_max_dim: int = 32)

Frozen configuration for every Flow Matching variant.

Parameters

sample_sizeint or tuple of int= 32
Spatial resolution of a sample.
in_channelsint= 3
Channels per sample.
out_channelsint= 3
Kept equal to in_channels: the field is a velocity in the same space as the sample, so it cannot change the dimension.
act_fn(silu, swish, relu, gelu)= "silu"
Activation inside the velocity field.
base_channelsint= 128
Width of the first U-Net stage.
channel_multtuple of int= (1, 2, 2, 2)
Per-stage width multipliers; the length sets the depth of the encoder/decoder ladder.
num_res_blocksint= 2
Residual blocks per resolution.
attention_resolutionstuple of int= (32, 16, 8)
Spatial sizes at which self-attention is applied.
num_head_channelsint= 64
Channels per attention head. The head count is derived per block, so a stage twice as wide gets twice as many heads — the multi-resolution attention the architecture this borrows from specifies.
dropoutfloat= 0.0
Dropout inside residual blocks.
resnet_groupsint= 32
GroupNorm groups; clamped down when a stage has fewer channels.
path(ot, diffusion)= "ot"
Which conditional probability path the regression target comes from. Both are trained by the same objective — that equivalence is the paper's point — and "ot" is the one it recommends.
sigma_minfloat= 1e-4
Width of the Gaussian left around a data point at t = 1. The paper requires only that it be "sufficiently small" and publishes no value, so this is a choice rather than a citation; anything small and positive behaves the same. At exactly zero the path degenerates to a pure straight line between the two samples.
beta_minfloat= 0.1, 20.0
Endpoints of the linear β(t)\beta(t) used by the diffusion path. Ignored when path="ot".
beta_maxfloat= 0.1, 20.0
Endpoints of the linear β(t)\beta(t) used by the diffusion path. Ignored when path="ot".
solverstr= "dopri5"
Method handed to lucid.diffeq.odeint for sampling and likelihood — the paper's own choice.
rtolfloat= 1e-5, 1e-5
Solver tolerances; the values the paper evaluates with.
atolfloat= 1e-5, 1e-5
Solver tolerances; the values the paper evaluates with.
trace_method(exact, hutchinson)= "exact"
How the divergence is obtained when scoring likelihood. None picks by dimension. Irrelevant to training.
trace_noise(rademacher, gaussian)= "rademacher"
Probe distribution for the Hutchinson estimate.
exact_trace_max_dimint= 32
Dimension below which trace_method=None resolves to "exact".

Notes

in_channels and out_channels must agree: the field lives in the sample's own space.

Examples

>>> from lucid.models.generative.flow_matching import FlowMatchingConfig
>>> FlowMatchingConfig().path
'ot'
>>> FlowMatchingConfig(sample_size=32, in_channels=3).data_dim
3072

Used by 3

Properties

2
prop

data_dim

→int
data_dim: int

int: Flattened width of one sample.

prop

resolved_trace_method

→TraceMethod
resolved_trace_method: TraceMethod

TraceMethod: trace_method, or the one implied by the dimension.