GithubHelp home page GithubHelp logo

Comments (6)

qixuema avatar qixuema commented on June 3, 2024

Hi @QWTforGithub , the x_0 in the paper is a one-hot row vector. When x_0 multiplies with Q_t in the formula, in the code, it effectively acts as indexing from the corresponding position in Q_t, I guess that's how it works.

I've also been following d3pm recently, feel free to reach out for discussion anytime.

from d3pm.

QWTforGithub avatar QWTforGithub commented on June 3, 2024

Hi @QWTforGithub , the x_0 in the paper is a one-hot row vector. When x_0 multiplies with Q_t in the formula, in the code, it effectively acts as indexing from the corresponding position in Q_t, I guess that's how it works.

I've also been following d3pm recently, feel free to reach out for discussion anytime.

Thank you for your reply. Now I have another question about "vb loss":

**def vb(self, dist1, dist2):

    # flatten dist1 and dist2
    dist1 = dist1.flatten(start_dim=0, end_dim=-2)
    dist2 = dist2.flatten(start_dim=0, end_dim=-2)

    out = torch.softmax(dist1 + self.eps, dim=-1) * (
        torch.log_softmax(dist1 + self.eps, dim=-1)
        - torch.log_softmax(dist2 + self.eps, dim=-1)
    )
    return out.sum(dim=-1).mean()**

My understanding of "vb loss" is "Variational Bayes Loss", that is, an MSE loss + a KL divergence. (torch.log_softmax(dist1 + self.eps, dim=-1) - torch.log_softmax(dist2 + self.eps, dim=-1))" can be considered as the difference of two posterior distributions (a KL divergence). But, why should What about multiplying by "torch.softmax(dist1 + self.eps, dim=-1)"? Looking forward to your reply.

from d3pm.

qixuema avatar qixuema commented on June 3, 2024

@QWTforGithub I feel that this should just be a simple calculation of the KL divergence loss.

$$ L(y_{pred}, y_{true}) = y_{true} \cdot \log \frac{y_{true}}{y_{pred}} = y_{true} \cdot (\log y_{true} - \log y_{pred}) $$

I feel that the step 'torch.softmax(dist1 + self.eps, dim=-1)' is just converting dist1 from logits to probabilities.

from d3pm.

QWTforGithub avatar QWTforGithub commented on June 3, 2024

@QWTforGithub I feel that this should just be a simple calculation of the KL divergence loss.

L(ypred,ytrue)=ytrue⋅log⁡ytrueypred=ytrue⋅(log⁡ytrue−log⁡ypred)

I feel that the step 'torch.softmax(dist1 + self.eps, dim=-1)' is just converting dist1 from logits to probabilities.

Thank you very much for your answer! May I ask you have tried to derive the formula in D3PM (Eq 3)? Why does the posterior distribution q(xt-1|xt,x0) get the form of Eq3? This transition probability p:
$$(x_tQ_t^T * x_0\bar{Q_{t-1}})/x_0\bar{Q_t}x^T$$
But not:
$$(x_{t-1}Q_t * x_0\bar{Q}_{t-1})/x_0\bar{Q}_t$$
How is Eq3 derived?

from d3pm.

qixuema avatar qixuema commented on June 3, 2024

@QWTforGithub Sorry, I feel it's a bit inappropriate to discuss here. I haven't found your email yet. If you don't mind, we can discuss on WeChat or elsewhere. Here's my email: [email protected].

from d3pm.

QWTforGithub avatar QWTforGithub commented on June 3, 2024

@QWTforGithub Sorry, I feel it's a bit inappropriate to discuss here. I haven't found your email yet. If you don't mind, we can discuss on WeChat or elsewhere. Here's my email: [email protected].

Thank you very much. I have sent a message to your email. I hope to communicate with you further.

from d3pm.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.