IDDPM#
- class dmme.diffusion_models.IDDPM(model: Module, timesteps: int = 1000, loss_type='hybrid', gamma=0.001, schedule: str = 'cosine', offset=0.008, start: float = 0.0001, end: float = 0.02)[source]#
Improved DDPM with cosine variance schedule and learned variance
- Parameters:
model – model predicting noise from data, \(\epsilon_\theta(x_t, t)\)
timesteps – total timesteps \(T\)
loss_type – loss type to use either “hybrid” or “simple”
gamma – \(\gamma\) in hybrid loss
shcedule – variance schedule to use either “linear” or “cosine”
offset – default offset to use if cosine schedule is used
start – default linear variance schedule start value
end – default linear variance schedule end value
- training_step(x_0)[source]#
Computes hybrid loss for improved DDPM
- Parameters:
x_0 – sample image to add noise and denoise for training
- Returns:
loss, \(L_\text{simple}\)