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

Confusion about get_learned_conditioning() #351

Open
SoHotLB opened this issue Feb 27, 2024 · 1 comment
Open

Confusion about get_learned_conditioning() #351

SoHotLB opened this issue Feb 27, 2024 · 1 comment

Comments

@SoHotLB
Copy link

SoHotLB commented Feb 27, 2024

Confusion about get_learned_conditioning() function
https://github.com/CompVis/latent-diffusion/blob/main/ldm/models/diffusion/ddpm.py#L551

def get_learned_conditioning(self, c):
    if self.cond_stage_forward is None:
        if hasattr(self.cond_stage_model, 'encode') and callable(self.cond_stage_model.encode):
            c = self.cond_stage_model.encode(c)
            if isinstance(c, DiagonalGaussianDistribution):
                c = c.mode()
        else:
            c = self.cond_stage_model(c)
    else:
        assert hasattr(self.cond_stage_model, self.cond_stage_forward)
        c = getattr(self.cond_stage_model, self.cond_stage_forward)(c)
    return c

If AutoencoderKL was used in the first stage, then the get_learned_conditioning() function should have been
c = c.sample()
Why is it c = c.mode() in the code?

@yanjin340121
Copy link

hi I feel like the problems we encountered are somewhat similar https://github.com/CompVis/latent-diffusion/issues/364

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

2 participants