chuchichaestli.diffusion.processes.ddim
Implementation of the Denoising Diffusion Implicit Model.
Classes:
| Name | Description |
|---|---|
DDIM |
Denoising Diffusion Implicit Model (DDIM). |
DDIM
DDIM(
num_timesteps: int,
num_sample_steps: int,
beta_start: float = 0.0001,
beta_end: float = 0.02,
device: str = "cpu",
schedule: str = "linear",
**kwargs,
)
Bases: DDPM
Denoising Diffusion Implicit Model (DDIM).
As described in the paper: "Denoising Diffusion Implicit Models" by Song et al. (2020); see https://arxiv.org/abs/2010.02502.
Initialize the DDIM scheme.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_timesteps
|
int
|
Number of timesteps. |
required |
num_sample_steps
|
int
|
Number of timesteps to sample. |
required |
beta_start
|
float
|
Start value for beta. |
0.0001
|
beta_end
|
float
|
End value for beta. |
0.02
|
device
|
str
|
Device to use. |
'cpu'
|
schedule
|
str
|
Annealing schedule |
'linear'
|
**kwargs
|
Additional keyword arguments. |
{}
|
Methods:
| Name | Description |
|---|---|
generate |
Sample from the DDPM model using DDIM. |
Source code in src/chuchichaestli/diffusion/processes/ddim.py
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 | |
generate
generate(
model: Callable[..., torch.Tensor],
condition: torch.Tensor | None = None,
shape: tuple[int, ...] | None = None,
n: int = 1,
yield_intermediate: bool = False,
*args,
**kwargs,
) -> Tensor | Generator[Tensor, None, torch.Tensor]
Sample from the DDPM model using DDIM.
Source code in src/chuchichaestli/diffusion/processes/ddim.py
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 | |