Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion nbs/15_DDPM.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
"class DDPMCB(TrainCB):\n",
" order = DeviceCB.order+1\n",
" def __init__(self, n_steps, beta_min, beta_max):\n",
" super().__init__()
" self.n_steps,self.βmin,self.βmax = n_steps,beta_min,beta_max\n",
" # variance schedule, linearly increased with timestep\n",
" self.β = torch.linspace(self.βmin, self.βmax, self.n_steps)\n",
Expand Down Expand Up @@ -295,7 +296,7 @@
" ᾱ_t1 = self.ᾱ[t-1] if t > 0 else torch.tensor(1)\n",
" b̄_t = 1 - self.ᾱ[t]\n",
" b̄_t1 = 1 - ᾱ_t1\n",
" noise_pred = learn.model(x_t, t_batch).sample\n",
" noise_pred = model(x_t, t_batch).sample\n",
" x_0_hat = ((x_t - b̄_t.sqrt() * noise_pred)/self.ᾱ[t].sqrt()).clamp(-1,1)\n",
" x0_coeff = ᾱ_t1.sqrt()*(1-self.α[t])/b̄_t\n",
" xt_coeff = self.α[t].sqrt()*b̄_t1/b̄_t\n",
Expand Down