score_sde_pytorch icon indicating copy to clipboard operation
score_sde_pytorch copied to clipboard

PC sampler mismatched?

Open mh-nguyen712 opened this issue 2 years ago • 4 comments

Hello, thanks for your interesting work!

I have a question about your implementation of PC sampler:

  def pc_sampler(model):
        with torch.no_grad():
            # Initial sample
            x = sde.prior_sampling(shape).to(device)
            timesteps = torch.linspace(sde.T, eps, sde.N, device=device)
      
            for i in range(sde.N):
                t = timesteps[i]
                vec_t = torch.ones(shape[0], device=t.device) * t
                x, x_mean = corrector_update_fn(x, vec_t, model=model)
                x, x_mean = predictor_update_fn(x, vec_t, model=model)
      
            return inverse_scaler(x_mean if denoise else x), sde.N * (n_steps + 1)

Why you start by correcter instead of predictor as in Alg 1. of your original paper? Is there any reason? Thank you very much!

mh-nguyen712 avatar Nov 16 '23 12:11 mh-nguyen712

I have the same question after reviewing these lines of code. @NguyenHai7120 Have you figured it out?

LiChenda avatar Feb 27 '24 03:02 LiChenda

Is it because after the prior sampling, you need to run a corrector first?

Long-louis avatar Mar 08 '24 11:03 Long-louis

Same question here. I guess it makes somewhat sense to use the corrector on the prior sampling. But even then the corrector is never applied to the final sample?

PhilippHoellmer avatar May 17 '24 15:05 PhilippHoellmer