Merge pull request #112 from if-ai/patch-1

Update interface.py
This commit is contained in:
Mr. For Example
2024-03-19 23:35:25 +01:00
committed by GitHub
+3 -2
View File
@@ -112,11 +112,12 @@ class LatentDiffusionInterface(nn.Module):
self.register_buffer(
"log_one_minus_alphas_cumprod", to_torch(np.log(1.0 - alphas_cumprod))
)
eps = 1e-8 # Added this epsilon to avoid divide by zero errors
self.register_buffer(
"sqrt_recip_alphas_cumprod", to_torch(np.sqrt(1.0 / alphas_cumprod))
"sqrt_recip_alphas_cumprod", to_torch(np.sqrt(1.0 / (alphas_cumprod + eps)))
)
self.register_buffer(
"sqrt_recipm1_alphas_cumprod", to_torch(np.sqrt(1.0 / alphas_cumprod - 1))
"sqrt_recipm1_alphas_cumprod", to_torch(np.sqrt(1.0 / (alphas_cumprod + eps) - 1))
)
# calculations for posterior q(x_{t-1} | x_t, x_0)