zju-pi / diff-sampler

An open-source toolbox for fast sampling of diffusion models. Official implementations for our [CVPR-2024, ICML-2024] papers
Apache License 2.0
165 stars 8 forks source link

AFS实现有误 #4

Closed YuChen-Liang closed 6 months ago

YuChen-Liang commented 6 months ago

GENIE中的afs:

x = torch.randn(sampling_shape, device=device)
x_bar = x * (1. + gamma[0] ** 2.).sqrt()
eps = x

本库中的AFS:

latents = rnd.randn([batch_size, net.img_channels, net.img_resolution, net.img_resolution], device=device)
x_cur = latents * t_cur
d_cur = x_cur / ((1 + t_cur**2).sqrt())

应改为

d_cur = latents

d_cur = x_cur / t_cur
zhyzhouu commented 6 months ago

1.x_cur = latents * t_cur是为了以EDM规定的初始分布为起点采样; 2.d_cur = x_cur / ((1 + t_cur**2).sqrt())是为了保持VP和VE之间的转化关系; 3.AFS本身是通过近似得到的方法,分母为t_cur的形式也可以从VE的角度出发得到; 4.t_cur=80,分母是t_cur还是(1 + t_cur**2).sqrt()对实验结果没什么影响。