Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why p_mean_variance use noise_level instead of sample_gammas like in training for time conditon of denoise function. #89

Open
zwmCool opened this issue Oct 4, 2023 · 3 comments

Comments

@zwmCool
Copy link

zwmCool commented Oct 4, 2023

training:

`
def forward(self, y_0,group,y_cond=None, mask=None, noise=None):

    # sampling from p(gammas)

    b, *_ = y_0.shape
    t = torch.randint(1, self.num_timesteps, (b,), device=y_0.device).long()
    
    gamma_t1 = extract(self.gammas, t-1, x_shape=(1, 1))
    sqrt_gamma_t2 = extract(self.gammas, t, x_shape=(1, 1))
    sample_gammas = (sqrt_gamma_t2-gamma_t1) * torch.rand((b, 1), device=y_0.device) + gamma_t1
    sample_gammas = sample_gammas.view(b, -1)
    ....
    noise_hat = self.denoise_fn(torch.cat([y_cond, y_noisy*mask+(1.-mask)*y_0], dim=1), sample_gammas)

`

inference:

`

def p_mean_variance(self, y_t, t,group, clip_denoised: bool, y_cond=None)

    noise_level = extract(self.gammas, t, x_shape=(1, 1)).to(y_t.device)

    y_0_hat = self.predict_start_from_noise(y_t, t=t, noise=self.denoise_fn(torch.cat([y_cond, y_t], dim=1), noise_level))

`

@xmhGit
Copy link

xmhGit commented Apr 17, 2024

I have the same question. Did you find the reason?

@kirin-from-16
Copy link

#50 i think the author explain this in here.

@xmhGit
Copy link

xmhGit commented Apr 23, 2024

#50 i think the author explain this in here.

Got it. Thanks~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants