Skip to content

priorschedule

Prior schedule functions for DDPM diffusion models.

This module defines a base abstract class for prior schedules and two common concrete implementations:

  • LinearPriorSchedule: \(\alpha(t) = t\)
  • QuadraticPriorSchedule: \(\alpha(t) = t^2\)

Classes:

Notes

It is assumed that the time steps t are normalized to the range [0, 1].

PriorSchedule

Bases: ABC

Abstract base class for prior schedules in DDPM models.

A prior schedule defines the mixing coefficient \(\alpha(t)\) that controls how the model incorporates the prior distribution over time steps in a diffusion process.

Methods:

  • alpha

    Compute the schedule coefficient \(\alpha\) at time \(t\).

alpha(t) abstractmethod

Compute the schedule coefficient \(\alpha\) at time \(t\).

Parameters:

  • t ((array_like, shape(dim1))) –

    Time steps \(t\in[0, 1]\).

Returns:

  • alpha_t ( (array_like, shape(dim1)) ) –

    Mixing coefficients corresponding to each time in \(t\).

Source code in src/fpsl/ddm/priorschedule.py
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
@abstractmethod
def alpha(self, t: Float[ArrayLike, ' dim1']) -> Float[ArrayLike, ' dim1']:
    r"""Compute the schedule coefficient $\alpha$ at time $t$.

    Parameters
    ----------
    t : array_like, shape (dim1,)
        Time steps $t\in[0, 1]$.

    Returns
    -------
    alpha_t : array_like, shape (dim1,)
        Mixing coefficients corresponding to each time in $t$.
    """
    raise NotImplementedError

LinearPriorSchedule

Bases: PriorSchedule

Linearly increasing prior schedule.

\(\alpha(t) = t\)

Methods:

  • alpha

    Compute the schedule coefficient \(\alpha\) at time \(t\).

alpha(t)

Linear schedule function.

Parameters:

  • t ((array_like, shape(dim1))) –

    Time steps \(t\in[0, 1]\).

Returns:

  • alpha_t ( (array_like, shape(dim1)) ) –

    Equal to the input t.

Source code in src/fpsl/ddm/priorschedule.py
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
def alpha(self, t: Float[ArrayLike, ' dim1']) -> Float[ArrayLike, ' dim1']:
    r"""Linear schedule function.

    Parameters
    ----------
    t : array_like, shape (dim1,)
        Time steps $t\in[0, 1]$.

    Returns
    -------
    alpha_t : array_like, shape (dim1,)
        Equal to the input t.
    """
    return t

QuadraticPriorSchedule

Bases: PriorSchedule

Quadratically increasing prior schedule \(\alpha(t) = t^2\).

Methods:

  • alpha

    Compute the schedule coefficient \(\alpha\) at time \(t\).

alpha(t)

Quadratic schedule function.

Parameters:

  • t ((array_like, shape(dim1))) –

    Time steps \(t\in[0, 1]\).

Returns:

  • alpha_t ( (array_like, shape(dim1)) ) –

    Squares of the input t.

Source code in src/fpsl/ddm/priorschedule.py
127
128
129
130
131
132
133
134
135
136
137
138
139
140
def alpha(self, t: Float[ArrayLike, ' dim1']) -> Float[ArrayLike, ' dim1']:
    r"""Quadratic schedule function.

    Parameters
    ----------
    t : array_like, shape (dim1,)
        Time steps $t\in[0, 1]$.

    Returns
    -------
    alpha_t : array_like, shape (dim1,)
        Squares of the input t.
    """
    return t**2