[2D LDM tutorial code] the scale factor #437
Unanswered
dreamyou070
asked this question in
Q&A
Replies: 1 comment
-
The value of 0.18215 was is the value of 1 / torch.std(z) determined in the latent diffusion model paper - see an explanation here, to ensure the inputs to the diffusion model have roughly unit variance. We just calculate the scaling factor for our specific dataset in case the variance is different. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
hello,
I am curious about the scaling factor.
In latent diffusion model, 0.18215 is mostly used scaling factor.
However in the 2D LDM tutorial code, another equation is used as below.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
with torch.no_grad():
with autocast(enabled=True):
z = autoencoderkl.encode_stage_2_inputs(check_data["image"].to(device))
print(f"Scaling factor set to {1/torch.std(z)}")
scale_factor = 1 / torch.std(z)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
What is different?
Beta Was this translation helpful? Give feedback.
All reactions