nngen
nngen copied to clipboard
ddim
大佬,我在跟你这个代码学习图像生成相关的知识,q(x_{t}| x_{t-1}) 和计算后验这一部分结合推理公式看了半天没看明白为啥这么计算的,方便教下吗?跪谢
(np.linspace(0, np.sqrt(self.timesteps * .8), ddim_timesteps)) ** 2 why 0.8? not 1?
half = dim // 2 freqs = torch.exp( -math.log(max_period) * torch.arange(start=0, end=half, dtype=torch.float32) / half ).to(device=timesteps.device) args = timesteps[:, None].float() * freqs[None] embedding = torch.cat([torch.cos(args), torch.sin(args)], dim=-1)